File: string_set_test.go

package info (click to toggle)
golang-github-cli-go-gh-v2 2.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 496 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package set

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func Test_StringSlice_ToSlice(t *testing.T) {
	s := NewStringSet()
	s.Add("one")
	s.Add("two")
	s.Add("three")
	s.Add("two")
	assert.Equal(t, []string{"one", "two", "three"}, s.ToSlice())
}

func Test_StringSlice_Remove(t *testing.T) {
	s := NewStringSet()
	s.Add("one")
	s.Add("two")
	s.Add("three")
	s.Remove("two")
	assert.Equal(t, []string{"one", "three"}, s.ToSlice())
	assert.False(t, s.Contains("two"))
	assert.Equal(t, 2, s.Len())
}