Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Sep 14, 2023
1 parent 341af4d commit 5533361
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions example/cmd/modifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,3 +465,60 @@ func TestSplitP(t *testing.T) {
Usage("SplitP()"))
})
}

func TestUniqueList(t *testing.T) {
sandbox.Package(t, "github.com/rsteube/carapace/example")(func(s *sandbox.Sandbox) {
s.Run("modifier", "--uniquelist", "").
Expect(carapace.ActionValues(
"one",
"two",
"three",
).NoSpace().
Usage("UniqueList()"))

s.Run("modifier", "--uniquelist", "two,").
Expect(carapace.ActionValues(
"one",
"three",
).Prefix("two,").
NoSpace().
Usage("UniqueList()"))
})
}

func TestUniqueListF(t *testing.T) {
sandbox.Package(t, "github.com/rsteube/carapace/example")(func(s *sandbox.Sandbox) {
s.Run("modifier", "--uniquelistf", "").
Expect(carapace.ActionValues(
"one",
"two",
"three",
).NoSpace().
Usage("UniqueListF()"))

s.Run("modifier", "--uniquelistf", "two,").
Expect(carapace.ActionValues(
"one",
"three",
).Prefix("two,").
NoSpace().
Usage("UniqueListF()"))

s.Run("modifier", "--uniquelistf", "two:").
Expect(carapace.ActionValues(
"1",
"2",
"3",
).Prefix("two:").
NoSpace().
Usage("UniqueListF()"))

s.Run("modifier", "--uniquelistf", "two:1,").
Expect(carapace.ActionValues(
"one",
"three",
).Prefix("two:1,").
NoSpace().
Usage("UniqueListF()"))
})
}

0 comments on commit 5533361

Please sign in to comment.