]> Cypherpunks.ru repositories - gostls13.git/blob - src/debug/goobj/read_test.go
dee140533c996c8bb232e786671eb96c0d4aaeff
[gostls13.git] / src / debug / goobj / read_test.go
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.
4
5 package goobj
6
7 import "testing"
8
9 var importPathToPrefixTests = []struct {
10         in  string
11         out string
12 }{
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"},
20 }
21
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)
26                 }
27         }
28 }