diff options
Diffstat (limited to 'storage/filesystem/storage_test.go')
-rw-r--r-- | storage/filesystem/storage_test.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/storage/filesystem/storage_test.go b/storage/filesystem/storage_test.go index 0127489..03d2e86 100644 --- a/storage/filesystem/storage_test.go +++ b/storage/filesystem/storage_test.go @@ -1,6 +1,7 @@ package filesystem import ( + "io/ioutil" "testing" "gopkg.in/src-d/go-git.v4/storage/test" @@ -14,31 +15,29 @@ func Test(t *testing.T) { TestingT(t) } type StorageSuite struct { test.BaseStorageSuite + dir string } var _ = Suite(&StorageSuite{}) func (s *StorageSuite) SetUpTest(c *C) { - storage, err := NewStorage(osfs.New(c.MkDir())) + s.dir = c.MkDir() + storage, err := NewStorage(osfs.New(s.dir)) c.Assert(err, IsNil) s.BaseStorageSuite = test.NewBaseStorageSuite(storage) } -func (s *StorageSuite) TestNewStorage(c *C) { +func (s *StorageSuite) TestFilesystem(c *C) { fs := memfs.New() storage, err := NewStorage(fs) c.Assert(err, IsNil) - c.Assert(storage, NotNil) - _, err = fs.Stat("refs/tags") - c.Assert(err, IsNil) + c.Assert(storage.Filesystem(), Equals, fs) } -func (s *StorageSuite) TestFilesystem(c *C) { - fs := memfs.New() - storage, err := NewStorage(fs) +func (s *StorageSuite) TestNewStorageShouldNotAddAnyContentsToDir(c *C) { + fis, err := ioutil.ReadDir(s.dir) c.Assert(err, IsNil) - - c.Assert(storage.Filesystem(), Equals, fs) + c.Assert(fis, HasLen, 0) } |