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"
"io/ioutil"
"os"
"path"
"sort"
"strings"
"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())
}
if fi.Name() != filename {
t.Errorf("Name() returned wrong value, want %q, got %q", filename, fi.Name())
if path.Base(fi.Name()) != 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())
}
}