diff options
| author | Ian Lance Taylor <iant@golang.org> | 2020-11-20 12:54:18 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2020-11-20 21:45:57 +0000 |
| commit | c47eac7db00e03776c3975025184e1938fbced75 (patch) | |
| tree | 07c205d279c0cca6e30e7f7540882591b3fbd344 /src/cmd/internal/pkgpath/pkgpath_test.go | |
| parent | 3fd491747247e95d00e24feccd1568b9e7eb37b4 (diff) | |
| download | go-c47eac7db00e03776c3975025184e1938fbced75.tar.xz | |
cmd/cgo, cmd/internal/pkgpath: support gofrontend mangler v3
The gofrontend mangling scheme used by gccgo and GoLLVM has changed again.
Support the new version. This is a port of the relevant parts of
https://golang.org/cl/271726.
For #41862
Change-Id: I9c961c8e17ec960a83a23e1d49ea900962b63393
Reviewed-on: https://go-review.googlesource.com/c/go/+/272127
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/internal/pkgpath/pkgpath_test.go')
| -rw-r--r-- | src/cmd/internal/pkgpath/pkgpath_test.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/cmd/internal/pkgpath/pkgpath_test.go b/src/cmd/internal/pkgpath/pkgpath_test.go index 7355f81bae..232e803a60 100644 --- a/src/cmd/internal/pkgpath/pkgpath_test.go +++ b/src/cmd/internal/pkgpath/pkgpath_test.go @@ -24,6 +24,9 @@ func init() { case "v2": os.Stdout.WriteString(`.string "go.l..u00e4ufer.Run"`) os.Exit(0) + case "v3": + os.Stdout.WriteString(`.string "go_0l_u00e4ufer.Run"`) + os.Exit(0) case "error": os.Stdout.WriteString(`unknown string`) os.Exit(0) @@ -46,6 +49,10 @@ func TestToSymbolFunc(t *testing.T) { mangled: "p..u00e4..u4e16..U0001f703", }, { + env: "v3", + mangled: "p_u00e4_u4e16_U0001f703", + }, + { env: "error", fail: true, }, @@ -75,32 +82,37 @@ func TestToSymbolFunc(t *testing.T) { } var symbolTests = []struct { - input, v1, v2 string + input, v1, v2, v3 string }{ { "", "", "", + "", }, { "bytes", "bytes", "bytes", + "bytes", }, { "net/http", "net_http", "net..z2fhttp", + "net_1http", }, { "golang.org/x/net/http", "golang_org_x_net_http", "golang.x2eorg..z2fx..z2fnet..z2fhttp", + "golang_0org_1x_1net_1http", }, { "pä世.🜃", "p____", "p..u00e4..u4e16.x2e..U0001f703", + "p_u00e4_u4e16_0_U0001f703", }, } @@ -119,3 +131,11 @@ func TestV2(t *testing.T) { } } } + +func TestV3(t *testing.T) { + for _, test := range symbolTests { + if got, want := toSymbolV3(test.input), test.v3; got != want { + t.Errorf("toSymbolV3(%q) = %q, want %q", test.input, got, want) + } + } +} |
