1 # Relative imports in command line package
2
3 # Run tests outside GOPATH.
4 env GOPATH=$WORK/tmp
5
6 go test ./testimport/p.go ./testimport/p_test.go ./testimport/x_test.go
7 stdout '^ok'
8
9 -- testimport/p.go --
10 package p
11
12 func F() int { return 1 }
13 -- testimport/p1/p1.go --
14 package p1
15
16 func F() int { return 1 }
17 -- testimport/p2/p2.go --
18 package p2
19
20 func F() int { return 1 }
21 -- testimport/p_test.go --
22 package p
23
24 import (
25 "./p1"
26
27 "testing"
28 )
29
30 func TestF(t *testing.T) {
31 if F() != p1.F() {
32 t.Fatal(F())
33 }
34 }
35 -- testimport/x_test.go --
36 package p_test
37
38 import (
39 . "../testimport"
40
41 "./p2"
42
43 "testing"
44 )
45
46 func TestF1(t *testing.T) {
47 if F() != p2.F() {
48 t.Fatal(F())
49 }
50 }
View as plain text