-
Notifications
You must be signed in to change notification settings - Fork 1
/
helpers_test.go
26 lines (22 loc) · 1.16 KB
/
helpers_test.go
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
package asyncp
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestStringArrMerge(t *testing.T) {
assert.ElementsMatch(t, []string{}, mergeStrArr(nil))
assert.ElementsMatch(t, []string{}, mergeStrArr(nil, nil))
assert.ElementsMatch(t, []string{}, mergeStrArr([]string{}, []string{}))
assert.ElementsMatch(t, []string{"a", "b"}, mergeStrArr([]string{"a", "b"}))
assert.ElementsMatch(t, []string{"a", "b"}, mergeStrArr([]string{"a"}, []string{"b"}))
assert.ElementsMatch(t, []string{"a", "b"}, mergeStrArr([]string{"a", "a"}, []string{"b", "b"}))
assert.ElementsMatch(t, []string{"a", "b"}, mergeStrArr([]string{"a", "b"}, []string{"a", "b"}))
}
func TestStringArrExclude(t *testing.T) {
assert.ElementsMatch(t, []string{}, excludeFromStrArr(nil))
assert.ElementsMatch(t, []string{}, excludeFromStrArr([]string{}))
assert.ElementsMatch(t, []string{}, excludeFromStrArr([]string{}, "a", "b"))
assert.ElementsMatch(t, []string{}, excludeFromStrArr([]string{"a", "b"}, "a", "b"))
assert.ElementsMatch(t, []string{"a"}, excludeFromStrArr([]string{"a", "b"}, "b"))
assert.ElementsMatch(t, []string{"a", "b"}, excludeFromStrArr([]string{"a", "b"}, "c", "d"))
}