utils tests
This commit is contained in:
parent
a06563d4c9
commit
d36d51257e
|
@ -3,6 +3,8 @@ package watcher
|
|||
import (
|
||||
"flag"
|
||||
"gopkg.in/urfave/cli.v2"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -37,3 +39,21 @@ func TestDuplicates(t *testing.T) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
func TestInArray(t *testing.T) {
|
||||
arr := []string{"a", "b", "c"}
|
||||
if !inArray(arr[0], arr) {
|
||||
t.Fatal("Unexpected", arr[0], "should be in", arr)
|
||||
}
|
||||
if inArray("d", arr) {
|
||||
t.Fatal("Unexpected", "d", "shouldn't be in", arr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetEnvPath(t *testing.T) {
|
||||
expected := filepath.SplitList(os.Getenv("GOPATH"))[0]
|
||||
result := getEnvPath("GOPATH")
|
||||
if expected != result {
|
||||
t.Fatal("Expected", expected, "instead", result)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue