summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/cobra/cobra/cmd/project_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/spf13/cobra/cobra/cmd/project_test.go')
-rw-r--r--vendor/github.com/spf13/cobra/cobra/cmd/project_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/project_test.go b/vendor/github.com/spf13/cobra/cobra/cmd/project_test.go
new file mode 100644
index 000000000..037f7c554
--- /dev/null
+++ b/vendor/github.com/spf13/cobra/cobra/cmd/project_test.go
@@ -0,0 +1,24 @@
+package cmd
+
+import (
+ "testing"
+)
+
+func TestFindExistingPackage(t *testing.T) {
+ path := findPackage("github.com/spf13/cobra")
+ if path == "" {
+ t.Fatal("findPackage didn't find the existing package")
+ }
+ if !hasGoPathPrefix(path) {
+ t.Fatalf("%q is not in GOPATH, but must be", path)
+ }
+}
+
+func hasGoPathPrefix(path string) bool {
+ for _, srcPath := range srcPaths {
+ if filepathHasPrefix(path, srcPath) {
+ return true
+ }
+ }
+ return false
+}