-
Notifications
You must be signed in to change notification settings - Fork 42
/
polyfill_test.go
78 lines (59 loc) · 1.73 KB
/
polyfill_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package polyfill
import (
"path/filepath"
"testing"
"github.com/go-git/go-billy/v5"
"github.com/go-git/go-billy/v5/test"
. "gopkg.in/check.v1"
)
func Test(t *testing.T) { TestingT(t) }
var _ = Suite(&PolyfillSuite{})
type PolyfillSuite struct {
Helper billy.Filesystem
Underlying billy.Filesystem
}
func (s *PolyfillSuite) SetUpTest(c *C) {
s.Helper = New(&test.BasicMock{})
}
func (s *PolyfillSuite) TestTempFile(c *C) {
_, err := s.Helper.TempFile("", "")
c.Assert(err, Equals, billy.ErrNotSupported)
}
func (s *PolyfillSuite) TestReadDir(c *C) {
_, err := s.Helper.ReadDir("")
c.Assert(err, Equals, billy.ErrNotSupported)
}
func (s *PolyfillSuite) TestMkdirAll(c *C) {
err := s.Helper.MkdirAll("", 0)
c.Assert(err, Equals, billy.ErrNotSupported)
}
func (s *PolyfillSuite) TestSymlink(c *C) {
err := s.Helper.Symlink("", "")
c.Assert(err, Equals, billy.ErrNotSupported)
}
func (s *PolyfillSuite) TestReadlink(c *C) {
_, err := s.Helper.Readlink("")
c.Assert(err, Equals, billy.ErrNotSupported)
}
func (s *PolyfillSuite) TestLstat(c *C) {
_, err := s.Helper.Lstat("")
c.Assert(err, Equals, billy.ErrNotSupported)
}
func (s *PolyfillSuite) TestChroot(c *C) {
_, err := s.Helper.Chroot("")
c.Assert(err, Equals, billy.ErrNotSupported)
}
func (s *PolyfillSuite) TestRoot(c *C) {
c.Assert(s.Helper.Root(), Equals, string(filepath.Separator))
}
func (s *PolyfillSuite) TestCapabilities(c *C) {
testCapabilities(c, new(test.BasicMock))
testCapabilities(c, new(test.OnlyReadCapFs))
testCapabilities(c, new(test.NoLockCapFs))
}
func testCapabilities(c *C, basic billy.Basic) {
baseCapabilities := billy.Capabilities(basic)
fs := New(basic)
capabilities := billy.Capabilities(fs)
c.Assert(capabilities, Equals, baseCapabilities)
}