refactor/rename: fix test failures in TestRewrites.
CL https://golang.org/cl/66130 changes go/printer to format one-method
interfaces to be printed on a single line. This change broke the
equality checkĀ in TestRewrites. Fix it by reformatting the expected
file buffers so that the tests pass with tip and previous Go versions.
Change-Id: I660efd81b362554db0515760dad7c8b62e4db1b3
Reviewed-on: https://go-review.googlesource.com/75812
Reviewed-by: Alan Donovan <adonovan@google.com>
diff --git a/refactor/rename/rename_test.go b/refactor/rename/rename_test.go
index a02db8f..87134a4 100644
--- a/refactor/rename/rename_test.go
+++ b/refactor/rename/rename_test.go
@@ -948,7 +948,9 @@
ctxt: fakeContext(map[string][]string{
"main": {`
package main
-type I interface { f() }
+type I interface {
+ f()
+}
type J interface { f(); g() }
type A int
func (A) f()
@@ -963,7 +965,7 @@
`,
},
}),
- offset: "/go/src/main/0.go:#33", to: "F", // abstract method I.f
+ offset: "/go/src/main/0.go:#34", to: "F", // abstract method I.f
want: map[string]string{
"/go/src/main/0.go": `package main
@@ -994,7 +996,7 @@
},
},
{
- offset: "/go/src/main/0.go:#58", to: "F", // abstract method J.f
+ offset: "/go/src/main/0.go:#59", to: "F", // abstract method J.f
want: map[string]string{
"/go/src/main/0.go": `package main
@@ -1025,7 +1027,7 @@
},
},
{
- offset: "/go/src/main/0.go:#63", to: "G", // abstract method J.g
+ offset: "/go/src/main/0.go:#64", to: "G", // abstract method J.g
want: map[string]string{
"/go/src/main/0.go": `package main
@@ -1060,7 +1062,9 @@
ctxt: fakeContext(map[string][]string{
"main": {`
package main
-type I interface { f() }
+type I interface {
+ f()
+}
type C int
func (C) f()
type D struct{C}
@@ -1068,7 +1072,7 @@
`,
},
}),
- offset: "/go/src/main/0.go:#33", to: "F", // abstract method I.f
+ offset: "/go/src/main/0.go:#34", to: "F", // abstract method I.f
want: map[string]string{
"/go/src/main/0.go": `package main
@@ -1090,14 +1094,16 @@
ctxt: fakeContext(map[string][]string{
"main": {`
package main
-type I interface {f()}
+type I interface {
+ f()
+}
type C struct{I}
func (C) g() int
var _ int = C{}.g()
`,
},
}),
- offset: "/go/src/main/0.go:#32", to: "g", // abstract method I.f
+ offset: "/go/src/main/0.go:#34", to: "g", // abstract method I.f
want: map[string]string{
"/go/src/main/0.go": `package main
@@ -1116,13 +1122,17 @@
{
ctxt: fakeContext(map[string][]string{
"main": {`package main
-type I interface{f()}
-type J interface{f()}
+type I interface{
+ f()
+}
+type J interface{
+ f()
+}
var _ = I(nil).(J)
`,
},
}),
- offset: "/go/src/main/0.go:#30", to: "g", // abstract method I.f
+ offset: "/go/src/main/0.go:#32", to: "g", // abstract method I.f
want: map[string]string{
"/go/src/main/0.go": `package main
@@ -1141,13 +1151,17 @@
{
ctxt: fakeContext(map[string][]string{
"main": {`package main
-type I interface{f()}
-type J interface{f()int}
+type I interface{
+ f()
+}
+type J interface{
+ f()int
+}
var _ = I(nil).(J)
`,
},
}),
- offset: "/go/src/main/0.go:#30", to: "g", // abstract method I.f
+ offset: "/go/src/main/0.go:#32", to: "g", // abstract method I.f
want: map[string]string{
"/go/src/main/0.go": `package main
@@ -1166,15 +1180,19 @@
{
ctxt: fakeContext(map[string][]string{
"main": {`package main
-type I interface{f()}
+type I interface{
+ f()
+}
type C int
func (C) f()
-type J interface{f()int}
+type J interface{
+ f()int
+}
var _ = I(C(0)).(J)
`,
},
}),
- offset: "/go/src/main/0.go:#30", to: "g", // abstract method I.f
+ offset: "/go/src/main/0.go:#32", to: "g", // abstract method I.f
want: map[string]string{
"/go/src/main/0.go": `package main