-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflag_test.go
More file actions
39 lines (32 loc) · 779 Bytes
/
flag_test.go
File metadata and controls
39 lines (32 loc) · 779 Bytes
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
package spec
import (
_ "embed"
"testing"
"github.com/carapace-sh/carapace"
"github.com/carapace-sh/carapace/pkg/sandbox"
)
//go:embed example/flag.yaml
var flagSpec string
func TestFlag(t *testing.T) {
sandboxSpec(t, flagSpec)(func(s *sandbox.Sandbox) {
s.Run("--hidden").
Expect(carapace.ActionValues().
NoSpace('.'))
s.Run("--hidden-arg", "").
Expect(carapace.ActionValues(
"h1",
"h2",
).Usage("hidden with argument"))
s.Run("--hidden-opt=").
Expect(carapace.ActionValues(
"ho1",
"ho2",
).Prefix("--hidden-opt=").
Usage("hidden with optional argument"))
s.Run("--repeatable", "--repeat").
Expect(carapace.ActionValuesDescribed(
"--repeatable", "repeatable",
).NoSpace('.').
Tag("longhand flags"))
})
}