diff --git a/watcher/utils_test.go b/watcher/utils_test.go index 866766b..2158caa 100644 --- a/watcher/utils_test.go +++ b/watcher/utils_test.go @@ -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) + } +}