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.
9 var importPathToPrefixTests
= []struct {
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"},
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
)