diff options
author | Alexander Rakoczy <alex@golang.org> | 2020-12-14 11:42:42 -0500 |
---|---|---|
committer | Alexander Rakoczy <alex@golang.org> | 2020-12-14 11:42:42 -0500 |
commit | 267975dc4732b6f6a62a7d33a85de34efef180b7 (patch) | |
tree | fd69c51067a279d959b233b94bccf2bf969317a7 /src/io/fs/readdir_test.go | |
parent | 63bc23b5452f6605df3e40ce7ecdd8b0348792af (diff) | |
parent | 6c64b6db6802818dd9a4789cdd564f19b70b6b4c (diff) | |
download | go-git-267975dc4732b6f6a62a7d33a85de34efef180b7.tar.gz |
Merge branch 'master' into dev.regabi
Change-Id: I098acdbc5e2676aeb8700d935e796a9c29d04b88
Diffstat (limited to 'src/io/fs/readdir_test.go')
-rw-r--r-- | src/io/fs/readdir_test.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/io/fs/readdir_test.go b/src/io/fs/readdir_test.go index 46a4bc2788..405bfa67ca 100644 --- a/src/io/fs/readdir_test.go +++ b/src/io/fs/readdir_test.go @@ -16,12 +16,12 @@ func (readDirOnly) Open(name string) (File, error) { return nil, ErrNotExist } func TestReadDir(t *testing.T) { check := func(desc string, dirs []DirEntry, err error) { t.Helper() - if err != nil || len(dirs) != 1 || dirs[0].Name() != "hello.txt" { + if err != nil || len(dirs) != 2 || dirs[0].Name() != "hello.txt" || dirs[1].Name() != "sub" { var names []string for _, d := range dirs { names = append(names, d.Name()) } - t.Errorf("ReadDir(%s) = %v, %v, want %v, nil", desc, names, err, []string{"hello.txt"}) + t.Errorf("ReadDir(%s) = %v, %v, want %v, nil", desc, names, err, []string{"hello.txt", "sub"}) } } @@ -32,4 +32,12 @@ func TestReadDir(t *testing.T) { // Test that ReadDir uses Open when the method is not present. dirs, err = ReadDir(openOnly{testFsys}, ".") check("openOnly", dirs, err) + + // Test that ReadDir on Sub of . works (sub_test checks non-trivial subs). + sub, err := Sub(testFsys, ".") + if err != nil { + t.Fatal(err) + } + dirs, err = ReadDir(sub, ".") + check("sub(.)", dirs, err) } |