Skip to content

Commit 610213d

Browse files
committed
helper/temporal: run full filesystem test suite
1 parent 3ce9d43 commit 610213d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

helper/temporal/temporal_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ func Test(t *testing.T) { TestingT(t) }
1515
var _ = Suite(&TemporalSuite{})
1616

1717
type TemporalSuite struct {
18-
test.TempFileSuite
18+
test.FilesystemSuite
1919
}
2020

2121
func (s *TemporalSuite) SetUpTest(c *C) {
22-
s.FS = New(memfs.New(), "foo")
22+
fs := New(memfs.New(), "foo")
23+
s.FilesystemSuite = test.NewFilesystemSuite(fs)
2324
}
2425

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

test/tempfile.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,19 @@ func (s *TempFileSuite) TestRemoveTempFile(c *C) {
4646
c.Assert(err, IsNil)
4747

4848
fn := f.Name()
49-
c.Assert(err, IsNil)
5049
c.Assert(f.Close(), IsNil)
5150
c.Assert(s.FS.Remove(fn), IsNil)
5251
}
5352

53+
func (s *TempFileSuite) TestRenameTempFile(c *C) {
54+
f, err := s.FS.TempFile("test-dir", "test-prefix")
55+
c.Assert(err, IsNil)
56+
57+
fn := f.Name()
58+
c.Assert(f.Close(), IsNil)
59+
c.Assert(s.FS.Rename(fn, "other-path"), IsNil)
60+
}
61+
5462
func (s *TempFileSuite) TestTempFileMany(c *C) {
5563
for i := 0; i < 1024; i++ {
5664
var fs []billy.File

0 commit comments

Comments
 (0)