Permalink
Browse files

tpl: Fix test to pass with gccgo

When run under gccgo, the test looks for the name that gccgo gives to
a thunk method.  This name is not normally visible, but can be seen
when using reflect.FuncForPC as this code does.  That name changed in
https://golang.org/cl/89555.  Change the test to work with both the
old name "$thunk0" and the new name "thunk0".

Fixes golang/go#28669
  • Loading branch information...
ianlancetaylor authored and bep committed Nov 9, 2018
1 parent 2900801 commit a8cb1b07b4cf7fcf0e949657cb03c1a4838f975e
Showing with 1 addition and 1 deletion.
  1. +1 −1 tpl/internal/templatefuncRegistry_test.go
@@ -31,7 +31,7 @@ func TestMethodToName(t *testing.T) {
test := &Test{}
if runtime.Compiler == "gccgo" {
require.Equal(t, "$thunk0", methodToName(test.MyTestMethod))
require.Contains(t, methodToName(test.MyTestMethod), "thunk")
} else {
require.Equal(t, "MyTestMethod", methodToName(test.MyTestMethod))
}

0 comments on commit a8cb1b0

Please sign in to comment.