...
1 package set
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/assert"
7 )
8
9 func Test_StringSlice_ToSlice(t *testing.T) {
10 s := NewStringSet()
11 s.Add("one")
12 s.Add("two")
13 s.Add("three")
14 s.Add("two")
15 assert.Equal(t, []string{"one", "two", "three"}, s.ToSlice())
16 }
17
18 func Test_StringSlice_Remove(t *testing.T) {
19 s := NewStringSet()
20 s.Add("one")
21 s.Add("two")
22 s.Add("three")
23 s.Remove("two")
24 assert.Equal(t, []string{"one", "three"}, s.ToSlice())
25 assert.False(t, s.Contains("two"))
26 assert.Equal(t, 2, s.Len())
27 }
28
View as plain text