mirror of
https://github.com/itchyny/mmv.git
synced 2025-12-26 22:24:58 +08:00
clone files for rename count test
This commit is contained in:
parent
b9e1d955b6
commit
7ab2aee878
1 changed files with 9 additions and 1 deletions
10
mmv_test.go
10
mmv_test.go
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue