Skip to content

Commit

Permalink
added bulk add/remove tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Sep 26, 2024
1 parent 645a622 commit c69471d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions v2/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,35 @@ func TestTagListUpper(t *testing.T) {
AssertEquals(true, a[0] == "One", t)
tags.Add("one")
AssertEquals(true, a[0] == "one", t)
}

func TestMultipleTagRemove(t *testing.T) {
tags := TagList{"a", "b", "c"}
a := []string(tags)
AssertEquals(true, a[0] == "a", t)
AssertEquals(true, a[1] == "b", t)
AssertEquals(true, a[2] == "c", t)

AssertEquals(true, tags.Contains("A"), t)
AssertEquals(true, tags.Contains("B"), t)
AssertEquals(true, tags.Contains("C"), t)

tags.Remove("A", "C")
AssertEquals(true, a[0] == "b", t)
}

func TestMultipleTagAddRemove(t *testing.T) {
tags := TagList{}
tags.Add("A", "B", "A", "C")
a := []string(tags)
AssertEquals(3, len(a), t)
AssertEquals(true, a[0] == "a", t)
AssertEquals(true, a[1] == "b", t)
AssertEquals(true, a[2] == "c", t)

tags.Remove("B", "B", "C")
AssertEquals(true, tags.Contains("A"), t)
AssertEquals(true, a[0] == "a", t)
}

func TestStringList(t *testing.T) {
Expand Down

0 comments on commit c69471d

Please sign in to comment.