23 lines
453 B
Go
23 lines
453 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestSliceInStringExist(t *testing.T) {
|
||
|
liste := []string{"text1", "text2"}
|
||
|
|
||
|
res := StringInSlice("text1", liste)
|
||
|
|
||
|
assert.Truef(t, res, "error message %s", "text1")
|
||
|
}
|
||
|
|
||
|
func TestSliceInStringNotExist(t *testing.T) {
|
||
|
liste := []string{"text1", "text2"}
|
||
|
|
||
|
res := StringInSlice("text3", liste)
|
||
|
|
||
|
assert.Falsef(t, res, "error message %s", "text3")
|
||
|
}
|