diff options
Diffstat (limited to 'libgo/go/strconv/quote_test.go')
-rw-r--r-- | libgo/go/strconv/quote_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libgo/go/strconv/quote_test.go b/libgo/go/strconv/quote_test.go index 4d615db443a..0311f77a3a7 100644 --- a/libgo/go/strconv/quote_test.go +++ b/libgo/go/strconv/quote_test.go @@ -168,6 +168,7 @@ var unquotetests = []unQuoteTest{ {"`\\xFF`", `\xFF`}, {"`\\377`", `\377`}, {"`\\`", `\`}, + {"`\n`", "\n"}, {"` `", ` `}, {"` `", ` `}, } @@ -189,6 +190,9 @@ var misquoted = []string{ "`\"", `"\'"`, `'\"'`, + "\"\n\"", + "\"\\n\n\"", + "'\n'", } func TestUnquote(t *testing.T) { @@ -211,3 +215,15 @@ func TestUnquote(t *testing.T) { } } } + +func BenchmarkUnquoteEasy(b *testing.B) { + for i := 0; i < b.N; i++ { + Unquote(`"Give me a rock, paper and scissors and I will move the world."`) + } +} + +func BenchmarkUnquoteHard(b *testing.B) { + for i := 0; i < b.N; i++ { + Unquote(`"\x47ive me a \x72ock, \x70aper and \x73cissors and \x49 will move the world."`) + } +} |