summaryrefslogtreecommitdiff
path: root/src/cmd/gofix/go1pkgrename_test.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-11-08 15:34:23 -0800
committerRob Pike <r@golang.org>2011-11-08 15:34:23 -0800
commit394c9152c957a1e4ce16806e4cd4026c6795969e (patch)
treeb4b442043d2ad1b0062e8d105c148ed244cdf821 /src/cmd/gofix/go1pkgrename_test.go
parentcdae7a3e4a07da46c4a9dbf098a197f81ab1b030 (diff)
downloadgo-394c9152c957a1e4ce16806e4cd4026c6795969e.tar.gz
gofix: add go1pkgrename
This will do the package import renamings for Go 1. R=rsc, r, dsymonds CC=golang-dev http://codereview.appspot.com/5316078
Diffstat (limited to 'src/cmd/gofix/go1pkgrename_test.go')
-rw-r--r--src/cmd/gofix/go1pkgrename_test.go98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/cmd/gofix/go1pkgrename_test.go b/src/cmd/gofix/go1pkgrename_test.go
new file mode 100644
index 000000000..464d67e7f
--- /dev/null
+++ b/src/cmd/gofix/go1pkgrename_test.go
@@ -0,0 +1,98 @@
+// 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(go1renameTests, go1pkgrename)
+}
+
+var go1renameTests = []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"
+)
+`,
+ 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"
+)
+`,
+ },
+ {
+ Name: "go1rename.1",
+ In: `package main
+
+import "cmath"
+import poot "exp/template/html"
+
+var _ = cmath.Sin
+var _ = poot.Poot
+`,
+ Out: `package main
+
+import "math/cmplx"
+import poot "html/template"
+
+var _ = cmplx.Sin
+var _ = poot.Poot
+`,
+ },
+}