diff options
author | Santiago M. Mola <santi@mola.io> | 2016-10-24 15:22:17 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-10-24 15:22:17 +0200 |
commit | cad256efb13b9067c2664001d5713507694bc411 (patch) | |
tree | b0b9c0653432865483c69e2cbc78c1f51718228b /utils/fs/test/fs_suite.go | |
parent | d45eb0402b2f3dace2ed1f91ee53e2c591a7ba3c (diff) | |
download | go-git-cad256efb13b9067c2664001d5713507694bc411.tar.gz |
utils/fs: add Remove(). (#94)
Diffstat (limited to 'utils/fs/test/fs_suite.go')
-rw-r--r-- | utils/fs/test/fs_suite.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/fs/test/fs_suite.go b/utils/fs/test/fs_suite.go index 109311f..055839e 100644 --- a/utils/fs/test/fs_suite.go +++ b/utils/fs/test/fs_suite.go @@ -149,6 +149,28 @@ func (s *FilesystemSuite) TestOpenAndStat(c *C) { c.Assert(stat.Name(), Equals, "foo") } +func (s *FilesystemSuite) TestRemove(c *C) { + f, err := s.Fs.Create("foo") + c.Assert(err, IsNil) + c.Assert(f.Close(), IsNil) + + err = s.Fs.Remove("foo") + c.Assert(err, IsNil) +} + +func (s *FilesystemSuite) TestRemoveNonExisting(c *C) { + c.Assert(s.Fs.Remove("NON-EXISTING"), NotNil) +} + +func (s *FilesystemSuite) TestRemoveTempFile(c *C) { + f, err := s.Fs.TempFile("test-dir", "test-prefix") + fn := f.Filename() + c.Assert(err, IsNil) + c.Assert(f.Close(), IsNil) + + c.Assert(s.Fs.Remove(fn), IsNil) +} + func (s *FilesystemSuite) TestJoin(c *C) { c.Assert(s.Fs.Join("foo", "bar"), Equals, "foo/bar") } |