diff options
author | Jakob Unterwurzacher | 2021-05-23 12:00:09 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2021-05-26 13:17:56 +0200 |
commit | 1b3c3b1347ef711ec38bb4c5cb14661035faf2ce (patch) | |
tree | 663aa26d1acef54045d526c2c4905b23045fe37a /internal/syscallcompat/getdents_test.go | |
parent | 7d72baca69825a83487728e000596241f4ac88fe (diff) |
syscallcompat: add GetdentsSpecial()
GetdentsSpecial calls then Getdents syscall,
with normal entries and "." / ".." split into two slices.
Diffstat (limited to 'internal/syscallcompat/getdents_test.go')
-rw-r--r-- | internal/syscallcompat/getdents_test.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/internal/syscallcompat/getdents_test.go b/internal/syscallcompat/getdents_test.go index cb95b7c..a6f41ca 100644 --- a/internal/syscallcompat/getdents_test.go +++ b/internal/syscallcompat/getdents_test.go @@ -83,7 +83,7 @@ func testGetdents(t *testing.T) { if err != nil { t.Fatal(err) } - getdentsEntries, err := getdentsUnderTest(int(fd.Fd())) + getdentsEntries, special, err := getdentsUnderTest(int(fd.Fd())) if err != nil { t.Log(err) skipOnGccGo(t) @@ -114,5 +114,20 @@ func testGetdents(t *testing.T) { } } } + if len(special) != 2 { + t.Error(special) + } + if !(special[0].Name == "." && special[1].Name == ".." || + special[1].Name == "." && special[0].Name == "..") { + t.Error(special) + } + for _, v := range special { + if v.Ino == 0 { + t.Error(v) + } + if v.Mode != syscall.S_IFDIR { + t.Error(v) + } + } } } |