Skip to content

Commit

Permalink
added nonposix interspersed test
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jul 16, 2023
1 parent 217f59a commit b401ea3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions example-nonposix/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func init() {
rootCmd.Flag("nargs-any").Nargs = -1
rootCmd.Flag("nargs-two").Nargs = 2

rootCmd.Flags().SetInterspersed(false)

carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{
"delim-colon": carapace.ActionValues("d1", "d2", "d3"),
"delim-slash": carapace.ActionValues("d1", "d2", "d3"),
Expand Down
14 changes: 14 additions & 0 deletions example-nonposix/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ func TestStandalone(t *testing.T) {
})
}

func TestInterspersed(t *testing.T) {
sandbox.Package(t, "github.com/rsteube/carapace/example-nonposix")(func(s *sandbox.Sandbox) {
s.Run("-delim-colon:d1", "-d").
Expect(carapace.ActionValuesDescribed(
"-delim-slash", "OptargDelimiter '/'",
).NoSpace('.').
Style(style.Yellow).
Tag("flags"))

s.Run("-delim-colon:d1", "positional1", "-d").
Expect(carapace.ActionValues())
})
}

func TestRoot(t *testing.T) {
sandbox.Package(t, "github.com/rsteube/carapace/example-nonposix")(func(s *sandbox.Sandbox) {
s.Run("-delim-colon:").
Expand Down

0 comments on commit b401ea3

Please sign in to comment.