Browse Source

helper/temporal: run full filesystem test suite

tags/v4.0.0
Santiago M. Mola 3 years ago
parent
commit
610213dcbd
2 changed files with 12 additions and 3 deletions
  1. +3
    -2
      helper/temporal/temporal_test.go
  2. +9
    -1
      test/tempfile.go

+ 3
- 2
helper/temporal/temporal_test.go View File

@@ -15,11 +15,12 @@ func Test(t *testing.T) { TestingT(t) }
var _ = Suite(&TemporalSuite{})

type TemporalSuite struct {
test.TempFileSuite
test.FilesystemSuite
}

func (s *TemporalSuite) SetUpTest(c *C) {
s.FS = New(memfs.New(), "foo")
fs := New(memfs.New(), "foo")
s.FilesystemSuite = test.NewFilesystemSuite(fs)
}

func (s *TemporalSuite) TestTempFileDefaultPath(c *C) {


+ 9
- 1
test/tempfile.go View File

@@ -46,11 +46,19 @@ func (s *TempFileSuite) TestRemoveTempFile(c *C) {
c.Assert(err, IsNil)

fn := f.Name()
c.Assert(err, IsNil)
c.Assert(f.Close(), IsNil)
c.Assert(s.FS.Remove(fn), IsNil)
}

func (s *TempFileSuite) TestRenameTempFile(c *C) {
f, err := s.FS.TempFile("test-dir", "test-prefix")
c.Assert(err, IsNil)

fn := f.Name()
c.Assert(f.Close(), IsNil)
c.Assert(s.FS.Rename(fn, "other-path"), IsNil)
}

func (s *TempFileSuite) TestTempFileMany(c *C) {
for i := 0; i < 1024; i++ {
var fs []billy.File


Loading…
Cancel
Save