diff options
author | Santiago M. Mola <santi@mola.io> | 2016-10-26 17:53:19 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-10-26 15:53:19 +0000 |
commit | f3ab3a6c73015b5ae9b2a4756dc646e1211cedb9 (patch) | |
tree | 7620dd91a19b0acc9c4d79dfa6cb672d9c033a3e | |
parent | f5b199f725c4695bbab7b3e202b6fca2a66f6ca3 (diff) | |
download | go-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.
-rw-r--r-- | utils/fs/test/fs_suite.go | 18 |
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") |