aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/fix/gotypes_test.go
blob: 9248fffd246bb00b94bb07cb197da3245936f72c (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

func init() {
	addTestCases(gotypesTests, gotypes)
}

var gotypesTests = []testCase{
	{
		Name: "gotypes.0",
		In: `package main

import "golang.org/x/tools/go/types"
import "golang.org/x/tools/go/exact"

var _ = exact.Kind

func f() {
	_ = exact.MakeBool(true)
}
`,
		Out: `package main

import "go/types"
import "go/constant"

var _ = constant.Kind

func f() {
	_ = constant.MakeBool(true)
}
`,
	},
	{
		Name: "gotypes.1",
		In: `package main

import "golang.org/x/tools/go/types"
import foo "golang.org/x/tools/go/exact"

var _ = foo.Kind

func f() {
	_ = foo.MakeBool(true)
}
`,
		Out: `package main

import "go/types"
import "go/constant"

var _ = foo.Kind

func f() {
	_ = foo.MakeBool(true)
}
`,
	},
	{
		Name: "gotypes.0",
		In: `package main

import "golang.org/x/tools/go/types"
import "golang.org/x/tools/go/exact"

var _ = exact.Kind
var constant = 23 // Use of new package name.

func f() {
	_ = exact.MakeBool(true)
}
`,
		Out: `package main

import "go/types"
import "go/constant"

var _ = constant_.Kind
var constant = 23 // Use of new package name.

func f() {
	_ = constant_.MakeBool(true)
}
`,
	},
}