MCPcopy
hub / github.com/kopia/kopia / TestCompareEmptyDirectories

Function TestCompareEmptyDirectories

internal/diff/diff_test.go:103–130  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestCompareEmptyDirectories(t *testing.T) {
104 var buf bytes.Buffer
105
106 ctx := context.Background()
107
108 dirModTime := time.Date(2023, time.April, 12, 10, 30, 0, 0, time.UTC)
109 dirOwnerInfo := fs.OwnerInfo{UserID: 1000, GroupID: 1000}
110 dirMode := os.FileMode(0o777)
111
112 oid1 := oidForString(t, "k", "sdkjfn")
113 oid2 := oidForString(t, "k", "dfjlgn")
114 dir1 := createTestDirectory("testDir1", dirModTime, dirOwnerInfo, dirMode, oid1)
115 dir2 := createTestDirectory("testDir2", dirModTime, dirOwnerInfo, dirMode, oid2)
116
117 c, err := diff.NewComparer(&buf, statsOnly)
118 require.NoError(t, err)
119
120 t.Cleanup(func() {
121 _ = c.Close()
122 })
123
124 expectedStats := diff.Stats{}
125 actualStats, err := c.Compare(ctx, dir1, dir2)
126
127 require.NoError(t, err)
128 require.Empty(t, buf.String())
129 require.Equal(t, expectedStats, actualStats)
130}
131
132func TestCompareIdenticalDirectories(t *testing.T) {
133 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 8

CloseMethod · 0.95
CompareMethod · 0.95
NewComparerFunction · 0.92
oidForStringFunction · 0.85
createTestDirectoryFunction · 0.85
EqualMethod · 0.80
CleanupMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected