summaryrefslogtreecommitdiff
path: root/src/pkg/debug/goobj/read_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/debug/goobj/read_test.go')
-rw-r--r--src/pkg/debug/goobj/read_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/pkg/debug/goobj/read_test.go b/src/pkg/debug/goobj/read_test.go
new file mode 100644
index 000000000..dee140533
--- /dev/null
+++ b/src/pkg/debug/goobj/read_test.go
@@ -0,0 +1,28 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package goobj
+
+import "testing"
+
+var importPathToPrefixTests = []struct {
+ in string
+ out string
+}{
+ {"runtime", "runtime"},
+ {"sync/atomic", "sync/atomic"},
+ {"code.google.com/p/go.tools/godoc", "code.google.com/p/go.tools/godoc"},
+ {"foo.bar/baz.quux", "foo.bar/baz%2equux"},
+ {"", ""},
+ {"%foo%bar", "%25foo%25bar"},
+ {"\x01\x00\x7F☺", "%01%00%7f%e2%98%ba"},
+}
+
+func TestImportPathToPrefix(t *testing.T) {
+ for _, tt := range importPathToPrefixTests {
+ if out := importPathToPrefix(tt.in); out != tt.out {
+ t.Errorf("importPathToPrefix(%q) = %q, want %q", tt.in, out, tt.out)
+ }
+ }
+}