From cad256efb13b9067c2664001d5713507694bc411 Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Mon, 24 Oct 2016 15:22:17 +0200 Subject: utils/fs: add Remove(). (#94) --- utils/fs/test/fs_suite.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'utils/fs/test') 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") } -- cgit