Skip to content

Commit

Permalink
fs: Add file info base name check in reader tests (restic#2063)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrmcnu committed Apr 28, 2019
1 parent 8d56889 commit fb78fbb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/fs/fs_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"io/ioutil"
"os"
"path"
"sort"
"strings"
"testing"
Expand Down Expand Up @@ -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())
}
}

Expand Down

0 comments on commit fb78fbb

Please sign in to comment.