Skip to content

Commit 3a072b1

Browse files
committed
tmp
1 parent e9065c6 commit 3a072b1

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

example/cmd/action_test.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,44 @@ func TestAction(t *testing.T) {
2424
Expect(carapace.ActionMessage("values flag is not set").
2525
Usage("ActionCallback()"))
2626

27+
s.Run("action", "--commands", "s").
28+
Expect(carapace.ActionValuesDescribed(
29+
"special", "",
30+
"subcommand", "subcommand example",
31+
).Suffix(" ").
32+
NoSpace().
33+
Tag("other commands").
34+
Usage("ActionCommands()"))
35+
36+
s.Run("action", "--commands", "subcommand ").
37+
Expect(carapace.Batch(
38+
carapace.ActionValuesDescribed(
39+
"a1", "subcommand with alias",
40+
"a2", "subcommand with alias",
41+
"alias", "subcommand with alias",
42+
).Tag("other commands"),
43+
carapace.ActionValuesDescribed(
44+
"group", "subcommand with group",
45+
).Style(style.Blue).Tag("group commands"),
46+
).ToA().
47+
Prefix("subcommand ").
48+
Suffix(" ").
49+
NoSpace().
50+
Usage("ActionCommands()"))
51+
52+
s.Run("action", "--commands", "subcommand unknown ").
53+
Expect(carapace.ActionMessage(`unknown subcommand "unknown" for "subcommand"`).NoSpace().
54+
Usage("ActionCommands()"))
55+
56+
s.Run("action", "--commands", "subcommand hidden ").
57+
Expect(carapace.ActionValuesDescribed(
58+
"visible", "visible subcommand of a hidden command",
59+
).Prefix("subcommand hidden ").
60+
Suffix(" ").
61+
NoSpace().
62+
Tag("commands").
63+
Usage("ActionCommands()"))
64+
2765
s.Run("action", "--values", "first", "--callback", "").
2866
Expect(carapace.ActionMessage("values flag is set to: 'first'").
2967
Usage("ActionCallback()"))

0 commit comments

Comments
 (0)