OSDN Git Service

Hulk did something
[bytom/vapor.git] / vendor / github.com / spf13 / cobra / cobra / cmd / project_test.go
1 package cmd
2
3 import (
4         "testing"
5 )
6
7 func TestFindExistingPackage(t *testing.T) {
8         path := findPackage("github.com/spf13/cobra")
9         if path == "" {
10                 t.Fatal("findPackage didn't find the existing package")
11         }
12         if !hasGoPathPrefix(path) {
13                 t.Fatalf("%q is not in GOPATH, but must be", path)
14         }
15 }
16
17 func hasGoPathPrefix(path string) bool {
18         for _, srcPath := range srcPaths {
19                 if filepathHasPrefix(path, srcPath) {
20                         return true
21                 }
22         }
23         return false
24 }