1// Copyright 2012 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package main 6 7func init() { 8 addTestCases(gotypesTests, gotypes) 9} 10 11var gotypesTests = []testCase{ 12 { 13 Name: "gotypes.0", 14 In: `package main 15 16import "golang.org/x/tools/go/types" 17import "golang.org/x/tools/go/exact" 18 19var _ = exact.Kind 20 21func f() { 22 _ = exact.MakeBool(true) 23} 24`, 25 Out: `package main 26 27import "go/types" 28import "go/constant" 29 30var _ = constant.Kind 31 32func f() { 33 _ = constant.MakeBool(true) 34} 35`, 36 }, 37 { 38 Name: "gotypes.1", 39 In: `package main 40 41import "golang.org/x/tools/go/types" 42import foo "golang.org/x/tools/go/exact" 43 44var _ = foo.Kind 45 46func f() { 47 _ = foo.MakeBool(true) 48} 49`, 50 Out: `package main 51 52import "go/types" 53import "go/constant" 54 55var _ = foo.Kind 56 57func f() { 58 _ = foo.MakeBool(true) 59} 60`, 61 }, 62 { 63 Name: "gotypes.0", 64 In: `package main 65 66import "golang.org/x/tools/go/types" 67import "golang.org/x/tools/go/exact" 68 69var _ = exact.Kind 70var constant = 23 // Use of new package name. 71 72func f() { 73 _ = exact.MakeBool(true) 74} 75`, 76 Out: `package main 77 78import "go/types" 79import "go/constant" 80 81var _ = constant_.Kind 82var constant = 23 // Use of new package name. 83 84func f() { 85 _ = constant_.MakeBool(true) 86} 87`, 88 }, 89} 90