forked from Eun/go-hit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clearpath_test.go
30 lines (28 loc) · 1.49 KB
/
clearpath_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
27
28
29
30
package hit
import "testing"
func TestClearPath_Contains(t *testing.T) {
tests := []struct {
haystack clearPath
needle clearPath
want bool
}{
{newClearPath("Foo", nil).Push("Bar", nil), newClearPath("Foo", nil).Push("Bar", nil), true},
{newClearPath("Foo", nil).Push("Bar", nil), newClearPath("Foo", nil), true},
{newClearPath("Foo", nil).Push("Bar", nil), newClearPath("Foo", []interface{}{1}), false},
{newClearPath("Foo", []interface{}{1}).Push("Bar", nil), newClearPath("Foo", nil), true},
{newClearPath("Foo", []interface{}{1}).Push("Bar", nil), newClearPath("Foo", nil).Push("Bar", nil), true},
{newClearPath("Foo", []interface{}{1}).Push("Bar", nil), newClearPath("Foo", []interface{}{1}), true},
{newClearPath("Foo", []interface{}{1}).Push("Bar", nil), newClearPath("Foo", []interface{}{1}).Push("Bar", nil), true},
{newClearPath("Foo", []interface{}{1}).Push("Bar", []interface{}{1}), newClearPath("Foo", []interface{}{1}).Push("Bar", []interface{}{1}), true},
{newClearPath("Foo", []interface{}{1}).Push("Bar", nil), newClearPath("Foo", []interface{}{2}), false},
{newClearPath("Foo", []interface{}{1, 2}).Push("Bar", nil), newClearPath("Foo", []interface{}{1}), true},
{newClearPath("Foo", []interface{}{1}).Push("Bar", nil), newClearPath("Foo", []interface{}{1, 2}), false},
}
for _, tt := range tests {
t.Run("", func(t *testing.T) {
if got := tt.haystack.Contains(tt.needle); got != tt.want {
t.Errorf("Contains() = %v, want %v", got, tt.want)
}
})
}
}