-
Notifications
You must be signed in to change notification settings - Fork 43
/
fs_test.go
40 lines (30 loc) · 970 Bytes
/
fs_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
package billy_test
import (
"testing"
. "github.com/go-git/go-billy/v5"
"github.com/go-git/go-billy/v5/test"
. "gopkg.in/check.v1"
)
type FSSuite struct{}
func Test(t *testing.T) { TestingT(t) }
var _ = Suite(&FSSuite{})
func (s *FSSuite) TestCapabilities(c *C) {
cases := []struct {
caps Capability
expected bool
}{
{LockCapability, false},
{ReadCapability, true},
{ReadCapability | WriteCapability, true},
{ReadCapability | WriteCapability | ReadAndWriteCapability | TruncateCapability, true},
{ReadCapability | WriteCapability | ReadAndWriteCapability | TruncateCapability | LockCapability, false},
{TruncateCapability | LockCapability, false},
}
// This filesystem supports all capabilities except for LockCapability
fs := new(test.NoLockCapFs)
for _, e := range cases {
c.Assert(CapabilityCheck(fs, e.caps), Equals, e.expected)
}
dummy := new(test.BasicMock)
c.Assert(Capabilities(dummy), Equals, DefaultCapabilities)
}