Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 723ab96

Browse files
smolamcuadros
authored andcommitted
utils/fs/test: add testing of stat on subdirs. (#99)
* Some 3rd party implementations had bugs on this that went unnoticed.
1 parent 91bc613 commit 723ab96

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

utils/fs/test/fs_suite.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,24 @@ func (s *FilesystemSuite) TestReadDirAndDir(c *C) {
9595
c.Assert(info, HasLen, 2)
9696
}
9797

98+
func (s *FilesystemSuite) TestDirStat(c *C) {
99+
files := []string{"foo", "bar", "qux/baz", "qux/qux"}
100+
for _, name := range files {
101+
f, err := s.Fs.Create(name)
102+
c.Assert(err, IsNil)
103+
c.Assert(f.Close(), IsNil)
104+
}
105+
106+
qux := s.Fs.Dir("qux")
107+
fi, err := qux.Stat("baz")
108+
c.Assert(err, IsNil)
109+
c.Assert(fi.Name(), Equals, "baz")
110+
111+
fi, err = qux.Stat("/baz")
112+
c.Assert(err, IsNil)
113+
c.Assert(fi.Name(), Equals, "baz")
114+
}
115+
98116
func (s *FilesystemSuite) TestCreateInDir(c *C) {
99117
dir := s.Fs.Dir("foo")
100118
f, err := dir.Create("bar")

0 commit comments

Comments
 (0)