aboutsummaryrefslogtreecommitdiffstats
path: root/utils/fs/test
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-10-26 17:53:19 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-10-26 15:53:19 +0000
commitf3ab3a6c73015b5ae9b2a4756dc646e1211cedb9 (patch)
tree7620dd91a19b0acc9c4d79dfa6cb672d9c033a3e /utils/fs/test
parentf5b199f725c4695bbab7b3e202b6fca2a66f6ca3 (diff)
downloadgo-git-f3ab3a6c73015b5ae9b2a4756dc646e1211cedb9.tar.gz
utils/fs/test: add testing of stat on subdirs. (#99)
* Some 3rd party implementations had bugs on this that went unnoticed.
Diffstat (limited to 'utils/fs/test')
-rw-r--r--utils/fs/test/fs_suite.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/fs/test/fs_suite.go b/utils/fs/test/fs_suite.go
index e8e04ab..a809309 100644
--- a/utils/fs/test/fs_suite.go
+++ b/utils/fs/test/fs_suite.go
@@ -95,6 +95,24 @@ func (s *FilesystemSuite) TestReadDirAndDir(c *C) {
c.Assert(info, HasLen, 2)
}
+func (s *FilesystemSuite) TestDirStat(c *C) {
+ files := []string{"foo", "bar", "qux/baz", "qux/qux"}
+ for _, name := range files {
+ f, err := s.Fs.Create(name)
+ c.Assert(err, IsNil)
+ c.Assert(f.Close(), IsNil)
+ }
+
+ qux := s.Fs.Dir("qux")
+ fi, err := qux.Stat("baz")
+ c.Assert(err, IsNil)
+ c.Assert(fi.Name(), Equals, "baz")
+
+ fi, err = qux.Stat("/baz")
+ c.Assert(err, IsNil)
+ c.Assert(fi.Name(), Equals, "baz")
+}
+
func (s *FilesystemSuite) TestCreateInDir(c *C) {
dir := s.Fs.Dir("foo")
f, err := dir.Create("bar")