diff options
author | Santiago M. Mola <santi@mola.io> | 2017-06-05 18:09:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-05 18:09:57 +0200 |
commit | 2a00316b65585be2bf68e1ea9c0e42c6af4f5679 (patch) | |
tree | bb6699e79ffd57b9141fe9c78300d69a3715885c /storage/filesystem/storage_test.go | |
parent | b25c5ead44698a4a036435c8977581ea34f761dd (diff) | |
parent | 88f88ea4cf5d44065edda8b06c2267a9dccea16e (diff) | |
download | go-git-2a00316b65585be2bf68e1ea9c0e42c6af4f5679.tar.gz |
Merge pull request #409 from smola/dirty-plainopen
storage/filesystem: call initialization explicitly, fixes #408
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) } |