]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: don't use directory foo which might exist under GOPATH
authorRobert Griesemer <gri@golang.org>
Fri, 1 Dec 2017 21:24:20 +0000 (13:24 -0800)
committerRobert Griesemer <gri@golang.org>
Fri, 1 Dec 2017 22:37:11 +0000 (22:37 +0000)
Simply choose an extremely unlikely path name in the test is fine.

Fixes #21013.

Change-Id: I56c0a1986b5ef5d618c7fe2b14701f584fe81c37
Reviewed-on: https://go-review.googlesource.com/81578
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/go/types/api_test.go

index 57daf0efb8b17d1c366e296d17aa83b1cba3cfbb..1d3c32520a615b1a5cb9d6ad39d49b49a3b69858 100644 (file)
@@ -1373,7 +1373,7 @@ func TestFailedImport(t *testing.T) {
        const src = `
 package p
 
-import "foo" // should only see an error here
+import foo "go/types/thisdirectorymustnotexistotherwisethistestmayfail/foo" // should only see an error here
 
 const c = foo.C
 type T = foo.T
@@ -1393,7 +1393,7 @@ func f(x T) T { return foo.F(x) }
                conf := Config{
                        Error: func(err error) {
                                // we should only see the import error
-                               if errcount > 0 || !strings.Contains(err.Error(), "could not import foo") {
+                               if errcount > 0 || !strings.Contains(err.Error(), "could not import") {
                                        t.Errorf("for %s importer, got unexpected error: %v", compiler, err)
                                }
                                errcount++