mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-30 07:58:59 +01:00
27 lines
509 B
Go
27 lines
509 B
Go
|
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))
|
||
|
})
|
||
|
}
|
||
|
}
|