clone files for rename count test

This commit is contained in:
itchyny 2020-01-08 11:09:14 +09:00
parent b9e1d955b6
commit 7ab2aee878

View file

@ -230,7 +230,7 @@ func TestRename(t *testing.T) {
require.NoError(t, os.Chdir(dir))
require.NoError(t, err)
require.NoError(t, setupFiles(tc.contents))
rs, _ := buildRenames(tc.files)
rs, _ := buildRenames(clone(tc.files))
assert.Equal(t, tc.cnt, len(rs))
got := Rename(tc.files)
if tc.err == nil {
@ -271,3 +271,11 @@ func fileContents(dir string) map[string]string {
}
return m
}
func clone(xs map[string]string) map[string]string {
ys := make(map[string]string, len(xs))
for k, v := range xs {
ys[k] = v
}
return ys
}