aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/testdata/script/test_relative_cmdline.txt
blob: 2f9c80fe4d5d8d43c1e6304a5fb2a8da19e7e0ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Relative imports in command line package

# Run tests outside GOPATH.
env GOPATH=$WORK/tmp

go test ./testimport/p.go ./testimport/p_test.go ./testimport/x_test.go
stdout '^ok'

-- testimport/p.go --
package p

func F() int { return 1 }
-- testimport/p1/p1.go --
package p1

func F() int { return 1 }
-- testimport/p2/p2.go --
package p2

func F() int { return 1 }
-- testimport/p_test.go --
package p

import (
	"./p1"

	"testing"
)

func TestF(t *testing.T) {
	if F() != p1.F() {
		t.Fatal(F())
	}
}
-- testimport/x_test.go --
package p_test

import (
	. "../testimport"

	"./p2"

	"testing"
)

func TestF1(t *testing.T) {
	if F() != p2.F() {
		t.Fatal(F())
	}
}