Skip to content

Commit

Permalink
Add test for side-effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ncabatoff committed Feb 7, 2024
1 parent 61255fb commit 1e82737
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions strutil/strutil_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ func TestStrListDelete(t *testing.T) {
if StrListContains(output, "item3") {
t.Fatal("bad: 'item3' should not have been present")
}

// Test that StrListDelete doesn't modify its input
input := []string{"a", "b", "c"}
output = StrListDelete(input, "b")
if !reflect.DeepEqual(input, []string{"a", "b", "c"}) {
t.Fatal("bad: input modified")
}
}

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

0 comments on commit 1e82737

Please sign in to comment.