MCPcopy
hub / github.com/kopia/kopia / TestStats

Function TestStats

snapshot/stats_test.go:11–41  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestStats(t *testing.T) {
12 d := mockfs.NewDirectory()
13 f := d.AddFile("foo", []byte{'b', 'a', 'r', 'b', 'a', 'z'}, 0)
14 tcs := []struct {
15 entry fs.Entry
16 want snapshot.Stats
17 }{
18 {
19 entry: d,
20 want: snapshot.Stats{
21 ExcludedDirCount: 1,
22 },
23 },
24 {
25 entry: f,
26 want: snapshot.Stats{
27 ExcludedFileCount: 1,
28 ExcludedTotalFileSize: f.Size(),
29 },
30 },
31 }
32
33 for _, tc := range tcs {
34 got := snapshot.Stats{}
35 got.AddExcluded(tc.entry)
36
37 if got != tc.want {
38 t.Errorf("Stats do not match, got: %#v, want %#v", got, tc.want)
39 }
40 }
41}

Callers

nothing calls this directly

Calls 5

AddFileMethod · 0.95
AddExcludedMethod · 0.95
NewDirectoryFunction · 0.92
ErrorfMethod · 0.80
SizeMethod · 0.45

Tested by

no test coverage detected