| 1 | package temporal |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | |
| 7 | "github.com/go-git/go-billy/v5/memfs" |
| 8 | "github.com/go-git/go-billy/v5/test" |
| 9 | |
| 10 | . "gopkg.in/check.v1" |
| 11 | ) |
| 12 | |
| 13 | func Test(t *testing.T) { TestingT(t) } |
| 14 | |
| 15 | var _ = Suite(&TemporalSuite{}) |
| 16 | |
| 17 | type TemporalSuite struct { |
| 18 | test.FilesystemSuite |
| 19 | } |
| 20 | |
| 21 | func (s *TemporalSuite) SetUpTest(c *C) { |
| 22 | fs := New(memfs.New(), "foo") |
| 23 | s.FilesystemSuite = test.NewFilesystemSuite(fs) |
| 24 | } |
| 25 | |
| 26 | func (s *TemporalSuite) TestTempFileDefaultPath(c *C) { |
| 27 | fs := New(memfs.New(), "foo") |
| 28 | f, err := fs.TempFile("", "bar") |
| 29 | c.Assert(err, IsNil) |
| 30 | c.Assert(f.Close(), IsNil) |
| 31 | |
| 32 | c.Assert(strings.HasPrefix(f.Name(), fs.Join("foo", "bar")), Equals, true) |
| 33 | } |