Commit 3c7d2e6a authored by Shawn Smith's avatar Shawn Smith Committed by Dave Cheney

os: improve Readdir and Readdirnames test coverage

R=golang-codereviews, dave
CC=golang-codereviews
https://golang.org/cl/46450043
parent 87327137
......@@ -252,11 +252,25 @@ func TestReaddirnames(t *testing.T) {
testReaddirnames(sysdir.name, sysdir.files, t)
}
func TestReaddirnamesNilFile(t *testing.T) {
var f *File
if fi, err := f.Readdirnames(1); fi != nil || err != ErrInvalid {
t.Errorf("Readdirnames should fail when f is nil: %v, %v", fi, err)
}
}
func TestReaddir(t *testing.T) {
testReaddir(".", dot, t)
testReaddir(sysdir.name, sysdir.files, t)
}
func TestReaddirNilFile(t *testing.T) {
var f *File
if fi, err := f.Readdir(1); fi != nil || err != ErrInvalid {
t.Errorf("Readdir should fail when f is nil: %v, %v", fi, err)
}
}
// Read the directory one entry at a time.
func smallReaddirnames(file *File, length int, t *testing.T) []string {
names := make([]string, length)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment