From f87b26504f684140edc9eb80258c3f27c91b92be Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Tue, 25 Oct 2016 11:32:11 +0200 Subject: utils/fs: add test for create file in dir. (#95) * Ensure that files can be created in a FS returned by Dir(). * Files created in a dir fs should have Filename() relative to dir's base. --- utils/fs/test/fs_suite.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'utils/fs/test') diff --git a/utils/fs/test/fs_suite.go b/utils/fs/test/fs_suite.go index 055839e..e8e04ab 100644 --- a/utils/fs/test/fs_suite.go +++ b/utils/fs/test/fs_suite.go @@ -95,6 +95,14 @@ func (s *FilesystemSuite) TestReadDirAndDir(c *C) { c.Assert(info, HasLen, 2) } +func (s *FilesystemSuite) TestCreateInDir(c *C) { + dir := s.Fs.Dir("foo") + f, err := dir.Create("bar") + c.Assert(err, IsNil) + c.Assert(f.Close(), IsNil) + c.Assert(f.Filename(), Equals, "bar") +} + func (s *FilesystemSuite) TestRename(c *C) { f, err := s.Fs.Create("foo") c.Assert(err, IsNil) -- cgit