aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2015-09-01 22:23:57 +0000
committerandroid-build-merger <android-build-merger@google.com>2015-09-01 22:23:57 +0000
commitfb03b3d75cae1775d886d69d4cba1f4f894cfd10 (patch)
treecf6578aacfb26280e547bf322f92b52d6cd33ae1
parent33a7c2394a19c6d8eafadd259796569a9a864331 (diff)
parent568df9f49c6b770aa78c34aae4db40cb75800f45 (diff)
downloadtools-fb03b3d75cae1775d886d69d4cba1f4f894cfd10.tar.gz
go/types: remove global vars in test
automerge: 568df9f * commit '568df9f49c6b770aa78c34aae4db40cb75800f45': go/types: remove global vars in test
-rw-r--r--go/types/resolver_test.go138
1 files changed, 69 insertions, 69 deletions
diff --git a/go/types/resolver_test.go b/go/types/resolver_test.go
index 6ad1c34..2ef1f18 100644
--- a/go/types/resolver_test.go
+++ b/go/types/resolver_test.go
@@ -16,80 +16,80 @@ import (
. "golang.org/x/tools/go/types"
)
-var sources = []string{
- `
- package p
- import "fmt"
- import "math"
- const pi = math.Pi
- func sin(x float64) float64 {
- return math.Sin(x)
- }
- var Println = fmt.Println
- `,
- `
- package p
- import "fmt"
- type errorStringer struct { fmt.Stringer; error }
- func f() string {
- _ = "foo"
- return fmt.Sprintf("%d", g())
- }
- func g() (x int) { return }
- `,
- `
- package p
- import . "go/parser"
- import "sync"
- func h() Mode { return ImportsOnly }
- var _, x int = 1, 2
- func init() {}
- type T struct{ *sync.Mutex; a, b, c int}
- type I interface{ m() }
- var _ = T{a: 1, b: 2, c: 3}
- func (_ T) m() {}
- func (T) _() {}
- var i I
- var _ = i.m
- func _(s []int) { for i, x := range s { _, _ = i, x } }
- func _(x interface{}) {
- switch x := x.(type) {
- case int:
- _ = x
+func TestResolveIdents(t *testing.T) {
+ skipSpecialPlatforms(t)
+
+ sources := []string{
+ `
+ package p
+ import "fmt"
+ import "math"
+ const pi = math.Pi
+ func sin(x float64) float64 {
+ return math.Sin(x)
}
- switch {} // implicit 'true' tag
- }
- `,
- `
- package p
- type S struct{}
- func (T) _() {}
- func (T) _() {}
- `,
- `
- package p
- func _() {
- L0:
- L1:
- goto L0
- for {
- goto L1
+ var Println = fmt.Println
+ `,
+ `
+ package p
+ import "fmt"
+ type errorStringer struct { fmt.Stringer; error }
+ func f() string {
+ _ = "foo"
+ return fmt.Sprintf("%d", g())
+ }
+ func g() (x int) { return }
+ `,
+ `
+ package p
+ import . "go/parser"
+ import "sync"
+ func h() Mode { return ImportsOnly }
+ var _, x int = 1, 2
+ func init() {}
+ type T struct{ *sync.Mutex; a, b, c int}
+ type I interface{ m() }
+ var _ = T{a: 1, b: 2, c: 3}
+ func (_ T) m() {}
+ func (T) _() {}
+ var i I
+ var _ = i.m
+ func _(s []int) { for i, x := range s { _, _ = i, x } }
+ func _(x interface{}) {
+ switch x := x.(type) {
+ case int:
+ _ = x
+ }
+ switch {} // implicit 'true' tag
}
- if true {
- goto L2
+ `,
+ `
+ package p
+ type S struct{}
+ func (T) _() {}
+ func (T) _() {}
+ `,
+ `
+ package p
+ func _() {
+ L0:
+ L1:
+ goto L0
+ for {
+ goto L1
+ }
+ if true {
+ goto L2
+ }
+ L2:
}
- L2:
+ `,
}
- `,
-}
-
-var pkgnames = []string{
- "fmt",
- "math",
-}
-func TestResolveIdents(t *testing.T) {
- skipSpecialPlatforms(t)
+ pkgnames := []string{
+ "fmt",
+ "math",
+ }
// parse package files
fset := token.NewFileSet()