diff --git a/mmv_test.go b/mmv_test.go index 6ba3b4c..5769d81 100644 --- a/mmv_test.go +++ b/mmv_test.go @@ -142,6 +142,10 @@ func TestRename(t *testing.T) { "foo": "0", "bar": "1", }, + expected: map[string]string{ + "foo": "0", + "bar": "1", + }, err: &emptyPathError{}, }, { @@ -154,6 +158,10 @@ func TestRename(t *testing.T) { "foo": "0", "bar": "1", }, + expected: map[string]string{ + "foo": "0", + "bar": "1", + }, err: &emptyPathError{}, }, { @@ -168,6 +176,11 @@ func TestRename(t *testing.T) { "bar": "1", "baz": "2", }, + expected: map[string]string{ + "foo": "0", + "bar": "1", + "baz": "2", + }, err: &sameDestinationError{"baz"}, }, { @@ -196,6 +209,10 @@ func TestRename(t *testing.T) { "foo": "0", "bar": "1", }, + expected: map[string]string{ + "foo": "0", + "bar": "1", + }, err: &sameSourceError{"foo"}, }, { @@ -208,6 +225,10 @@ func TestRename(t *testing.T) { "foo": "0", "bar": "1", }, + expected: map[string]string{ + "foo": "0", + "bar": "1", + }, err: &sameDestinationError{"baz"}, }, { @@ -262,13 +283,13 @@ func TestRename(t *testing.T) { require.NoError(t, setupFiles(tc.contents)) rs, _ := buildRenames(clone(tc.files)) assert.Equal(t, tc.count, len(rs)) - got := Rename(tc.files) + err = Rename(tc.files) if tc.err == nil { - require.NoError(t, got) - assert.Equal(t, tc.expected, fileContents(".")) + assert.NoError(t, err) } else { - assert.Equal(t, tc.err, got) + assert.Equal(t, tc.err, err) } + assert.Equal(t, tc.expected, fileContents(".")) }) } }