aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/pkgpath/pkgpath_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/internal/pkgpath/pkgpath_test.go')
-rw-r--r--src/cmd/internal/pkgpath/pkgpath_test.go22
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)
+ }
+ }
+}