From 55333618d840cc7320ccc9def8c402b16b755b31 Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 14 Sep 2023 11:06:09 +0200 Subject: [PATCH] tmp --- example/cmd/modifier_test.go | 57 ++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/example/cmd/modifier_test.go b/example/cmd/modifier_test.go index 7dad4c0fe..8f4081ad9 100644 --- a/example/cmd/modifier_test.go +++ b/example/cmd/modifier_test.go @@ -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()")) + }) +}