2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 06:46:34 +00:00

fs: Add file info base name check in reader tests (#2063)

This commit is contained in:
Garry McNulty 2019-04-28 20:55:31 +01:00 committed by Alexander Neumann
parent 5096f3b491
commit f7f14cf8c9

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"io/ioutil" "io/ioutil"
"os" "os"
"path"
"sort" "sort"
"strings" "strings"
"testing" "testing"
@ -163,8 +164,12 @@ func checkFileInfo(t testing.TB, fi os.FileInfo, filename string, modtime time.T
t.Errorf("ModTime() returned wrong value, want %v, got %v", modtime, fi.ModTime()) t.Errorf("ModTime() returned wrong value, want %v, got %v", modtime, fi.ModTime())
} }
if fi.Name() != filename { if path.Base(fi.Name()) != fi.Name() {
t.Errorf("Name() returned wrong value, want %q, got %q", filename, fi.Name()) t.Errorf("Name() returned is not base, want %q, got %q", path.Base(fi.Name()), fi.Name())
}
if fi.Name() != path.Base(filename) {
t.Errorf("Name() returned wrong value, want %q, got %q", path.Base(filename), fi.Name())
} }
} }