Skip to content

Commit

Permalink
fix error message check in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hanagantig committed Sep 23, 2023
1 parent ecbd067 commit 9fcc89f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions memmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -940,15 +940,15 @@ func TestMemMapFsRemove(t *testing.T) {
"/parent1/parent2",
"/parent1/parent2/fileForDelete1.txt",
},
expectedErrMsg: "remove /parent1/parent2/fileForDelete1.txt: file does not exist",
expectedErrMsg: "fileForDelete1.txt: file does not exist",
},
"Remove root and then parent1 - should return error": {
dirsToCreate: []string{"/root/parent1/parent2/fileForDelete1.txt"},
dirsToRemove: []string{
"/root",
"/root/parent1",
},
expectedErrMsg: "remove /root/parent1: file does not exist",
expectedErrMsg: "parent1: file does not exist",
},
"Remove parent2 and then parent 1 - success": {
dirsToCreate: []string{"/parent1/parent2/fileForDelete1.txt"},
Expand Down Expand Up @@ -979,7 +979,7 @@ func TestMemMapFsRemove(t *testing.T) {

for _, toRemove := range td.dirsToRemove {
err = fs.Remove(toRemove)
if err != nil && err.Error() != td.expectedErrMsg {
if err != nil && !strings.Contains(err.Error(), td.expectedErrMsg) {
t.Fatalf("#CASE %v %s: Remove %q failed: %v", caseName, fs.Name(), toRemove, err)
}
}
Expand Down

0 comments on commit 9fcc89f

Please sign in to comment.