-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathfs_test.go
33 lines (27 loc) · 904 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
package billy_test
import (
"testing"
. "github.com/go-git/go-billy/v6" //nolint
"github.com/go-git/go-billy/v6/internal/test"
"github.com/stretchr/testify/assert"
)
func TestCapabilities(t *testing.T) {
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 {
assert.Equal(t, CapabilityCheck(fs, e.caps), e.expected)
}
dummy := new(test.BasicMock)
assert.Equal(t, Capabilities(dummy), DefaultCapabilities)
}