summaryrefslogtreecommitdiff
path: root/src/cmd/fix/go1pkgrename_test.go
blob: 840e443b01ea2a50588d09da6363d5c983567e8f (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Copyright 2011 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(go1pkgrenameTests, go1pkgrename)
}

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

import (
	"asn1"
	"big"
	"cmath"
	"csv"
	"exec"
	"exp/template/html"
	"gob"
	"http"
	"http/cgi"
	"http/fcgi"
	"http/httptest"
	"http/pprof"
	"json"
	"mail"
	"rand"
	"rpc"
	"rpc/jsonrpc"
	"scanner"
	"smtp"
	"syslog"
	"tabwriter"
	"template"
	"template/parse"
	"url"
	"utf16"
	"utf8"
	"xml"

	"crypto/bcrypt"
)
`,
		Out: `package main

import (
	"encoding/asn1"
	"encoding/csv"
	"encoding/gob"
	"encoding/json"
	"encoding/xml"
	"html/template"
	"log/syslog"
	"math/big"
	"math/cmplx"
	"math/rand"
	"net/http"
	"net/http/cgi"
	"net/http/fcgi"
	"net/http/httptest"
	"net/http/pprof"
	"net/mail"
	"net/rpc"
	"net/rpc/jsonrpc"
	"net/smtp"
	"net/url"
	"os/exec"
	"text/scanner"
	"text/tabwriter"
	"text/template"
	"text/template/parse"
	"unicode/utf16"
	"unicode/utf8"

	"code.google.com/p/go.crypto/bcrypt"
)
`,
	},
	{
		Name: "go1rename.1",
		In: `package main

import "cmath"
import poot "exp/template/html"

import (
	"ebnf"
	"old/regexp"
)

var _ = cmath.Sin
var _ = poot.Poot
`,
		Out: `package main

import "math/cmplx"
import poot "html/template"

import (
	"exp/ebnf"
	"old/regexp"
)

var _ = cmplx.Sin
var _ = poot.Poot
`,
	},
	{
		Name: "go1rename.2",
		In: `package foo

import (
	"fmt"
	"http"
	"url"

	"google/secret/project/go"
)

func main() {}
`,
		Out: `package foo

import (
	"fmt"
	"net/http"
	"net/url"

	"google/secret/project/go"
)

func main() {}
`,
	},
}