mirror of
https://github.com/containers/podman.git
synced 2025-10-26 02:35:43 +08:00
util_test.go: Unittests for util.go
Add unit tests for func StringInSlice. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
@ -1,10 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
19
libpod/util_test.go
Normal file
19
libpod/util_test.go
Normal file
@ -0,0 +1,19 @@
|
||||
package libpod
|
||||
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
var (
|
||||
sliceData = []string{"one", "two", "three", "four"}
|
||||
)
|
||||
|
||||
func TestStringInSlice(t *testing.T) {
|
||||
// string is in the slice
|
||||
assert.True(t, StringInSlice("one", sliceData))
|
||||
// string is not in the slice
|
||||
assert.False(t, StringInSlice("five", sliceData))
|
||||
// string is not in empty slice
|
||||
assert.False(t, StringInSlice("one", []string{}))
|
||||
}
|
||||
Reference in New Issue
Block a user