libgo: Merge from revision 18783:00cce3a34d7e of master library.
[official-gcc.git] / libgo / go / debug / goobj / read_test.go
blobdee140533c996c8bb232e786671eb96c0d4aaeff
1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package goobj
7 import "testing"
9 var importPathToPrefixTests = []struct {
10 in string
11 out string
13 {"runtime", "runtime"},
14 {"sync/atomic", "sync/atomic"},
15 {"code.google.com/p/go.tools/godoc", "code.google.com/p/go.tools/godoc"},
16 {"foo.bar/baz.quux", "foo.bar/baz%2equux"},
17 {"", ""},
18 {"%foo%bar", "%25foo%25bar"},
19 {"\x01\x00\x7F☺", "%01%00%7f%e2%98%ba"},
22 func TestImportPathToPrefix(t *testing.T) {
23 for _, tt := range importPathToPrefixTests {
24 if out := importPathToPrefix(tt.in); out != tt.out {
25 t.Errorf("importPathToPrefix(%q) = %q, want %q", tt.in, out, tt.out)