1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-30 07:58:59 +01:00
gojekyll/utils/arrays_test.go

27 lines
509 B
Go
Raw Normal View History

2017-09-01 15:27:03 +02:00
package utils
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func TestSearchStrings(t *testing.T) {
tests := []struct {
a []string
s string
expect bool
}{
{[]string{}, "a", false},
{[]string{"a", "b"}, "a", true},
{[]string{"a", "b"}, "b", true},
{[]string{"a", "b"}, "c", false},
}
for _, tt := range tests {
t.Run(fmt.Sprintf("SearchStrings(%v, %v)", tt.a, tt.s), func(t *testing.T) {
require.Equal(t, tt.expect, SearchStrings(tt.a, tt.s))
})
}
}