From 9fcc89f876fede0588005d04ea285d114d59224f Mon Sep 17 00:00:00 2001 From: Tigran Date: Wed, 13 Sep 2023 19:54:01 +0400 Subject: [PATCH] fix error message check in tests --- memmap_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/memmap_test.go b/memmap_test.go index dbf89b4..124af7e 100644 --- a/memmap_test.go +++ b/memmap_test.go @@ -940,7 +940,7 @@ 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"}, @@ -948,7 +948,7 @@ func TestMemMapFsRemove(t *testing.T) { "/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"}, @@ -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) } }