diff options
Diffstat (limited to 'src/pkg/strconv/quote_test.go')
-rw-r--r-- | src/pkg/strconv/quote_test.go | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/src/pkg/strconv/quote_test.go b/src/pkg/strconv/quote_test.go index 31784879a..1235fcb9a 100644 --- a/src/pkg/strconv/quote_test.go +++ b/src/pkg/strconv/quote_test.go @@ -16,12 +16,12 @@ type quoteTest struct { } var quotetests = []quoteTest{ - quoteTest{"\a\b\f\r\n\t\v", `"\a\b\f\r\n\t\v"`}, - quoteTest{"\\", `"\\"`}, - quoteTest{"abc\xffdef", `"abc\xffdef"`}, - quoteTest{"\u263a", `"\u263a"`}, - quoteTest{"\U0010ffff", `"\U0010ffff"`}, - quoteTest{"\x04", `"\x04"`}, + {"\a\b\f\r\n\t\v", `"\a\b\f\r\n\t\v"`}, + {"\\", `"\\"`}, + {"abc\xffdef", `"abc\xffdef"`}, + {"\u263a", `"\u263a"`}, + {"\U0010ffff", `"\U0010ffff"`}, + {"\x04", `"\x04"`}, } func TestQuote(t *testing.T) { @@ -39,44 +39,44 @@ type canBackquoteTest struct { } var canbackquotetests = []canBackquoteTest{ - canBackquoteTest{"`", false}, - canBackquoteTest{string(0), false}, - canBackquoteTest{string(1), false}, - canBackquoteTest{string(2), false}, - canBackquoteTest{string(3), false}, - canBackquoteTest{string(4), false}, - canBackquoteTest{string(5), false}, - canBackquoteTest{string(6), false}, - canBackquoteTest{string(7), false}, - canBackquoteTest{string(8), false}, - canBackquoteTest{string(9), true}, // \t - canBackquoteTest{string(10), false}, - canBackquoteTest{string(11), false}, - canBackquoteTest{string(12), false}, - canBackquoteTest{string(13), false}, - canBackquoteTest{string(14), false}, - canBackquoteTest{string(15), false}, - canBackquoteTest{string(16), false}, - canBackquoteTest{string(17), false}, - canBackquoteTest{string(18), false}, - canBackquoteTest{string(19), false}, - canBackquoteTest{string(20), false}, - canBackquoteTest{string(21), false}, - canBackquoteTest{string(22), false}, - canBackquoteTest{string(23), false}, - canBackquoteTest{string(24), false}, - canBackquoteTest{string(25), false}, - canBackquoteTest{string(26), false}, - canBackquoteTest{string(27), false}, - canBackquoteTest{string(28), false}, - canBackquoteTest{string(29), false}, - canBackquoteTest{string(30), false}, - canBackquoteTest{string(31), false}, - canBackquoteTest{`' !"#$%&'()*+,-./:;<=>?@[\]^_{|}~`, true}, - canBackquoteTest{`0123456789`, true}, - canBackquoteTest{`ABCDEFGHIJKLMNOPQRSTUVWXYZ`, true}, - canBackquoteTest{`abcdefghijklmnopqrstuvwxyz`, true}, - canBackquoteTest{`☺`, true}, + {"`", false}, + {string(0), false}, + {string(1), false}, + {string(2), false}, + {string(3), false}, + {string(4), false}, + {string(5), false}, + {string(6), false}, + {string(7), false}, + {string(8), false}, + {string(9), true}, // \t + {string(10), false}, + {string(11), false}, + {string(12), false}, + {string(13), false}, + {string(14), false}, + {string(15), false}, + {string(16), false}, + {string(17), false}, + {string(18), false}, + {string(19), false}, + {string(20), false}, + {string(21), false}, + {string(22), false}, + {string(23), false}, + {string(24), false}, + {string(25), false}, + {string(26), false}, + {string(27), false}, + {string(28), false}, + {string(29), false}, + {string(30), false}, + {string(31), false}, + {`' !"#$%&'()*+,-./:;<=>?@[\]^_{|}~`, true}, + {`0123456789`, true}, + {`ABCDEFGHIJKLMNOPQRSTUVWXYZ`, true}, + {`abcdefghijklmnopqrstuvwxyz`, true}, + {`☺`, true}, } func TestCanBackquote(t *testing.T) { @@ -89,41 +89,41 @@ func TestCanBackquote(t *testing.T) { } var unquotetests = []quoteTest{ - quoteTest{`""`, ""}, - quoteTest{`"a"`, "a"}, - quoteTest{`"abc"`, "abc"}, - quoteTest{`"☺"`, "☺"}, - quoteTest{`"hello world"`, "hello world"}, - quoteTest{`"\xFF"`, "\xFF"}, - quoteTest{`"\377"`, "\377"}, - quoteTest{`"\u1234"`, "\u1234"}, - quoteTest{`"\U00010111"`, "\U00010111"}, - quoteTest{`"\U0001011111"`, "\U0001011111"}, - quoteTest{`"\a\b\f\n\r\t\v\\\""`, "\a\b\f\n\r\t\v\\\""}, - quoteTest{`"'"`, "'"}, + {`""`, ""}, + {`"a"`, "a"}, + {`"abc"`, "abc"}, + {`"☺"`, "☺"}, + {`"hello world"`, "hello world"}, + {`"\xFF"`, "\xFF"}, + {`"\377"`, "\377"}, + {`"\u1234"`, "\u1234"}, + {`"\U00010111"`, "\U00010111"}, + {`"\U0001011111"`, "\U0001011111"}, + {`"\a\b\f\n\r\t\v\\\""`, "\a\b\f\n\r\t\v\\\""}, + {`"'"`, "'"}, - quoteTest{`'a'`, "a"}, - quoteTest{`'☹'`, "☹"}, - quoteTest{`'\a'`, "\a"}, - quoteTest{`'\x10'`, "\x10"}, - quoteTest{`'\377'`, "\377"}, - quoteTest{`'\u1234'`, "\u1234"}, - quoteTest{`'\U00010111'`, "\U00010111"}, - quoteTest{`'\t'`, "\t"}, - quoteTest{`' '`, " "}, - quoteTest{`'\''`, "'"}, - quoteTest{`'"'`, "\""}, + {`'a'`, "a"}, + {`'☹'`, "☹"}, + {`'\a'`, "\a"}, + {`'\x10'`, "\x10"}, + {`'\377'`, "\377"}, + {`'\u1234'`, "\u1234"}, + {`'\U00010111'`, "\U00010111"}, + {`'\t'`, "\t"}, + {`' '`, " "}, + {`'\''`, "'"}, + {`'"'`, "\""}, - quoteTest{"``", ``}, - quoteTest{"`a`", `a`}, - quoteTest{"`abc`", `abc`}, - quoteTest{"`☺`", `☺`}, - quoteTest{"`hello world`", `hello world`}, - quoteTest{"`\\xFF`", `\xFF`}, - quoteTest{"`\\377`", `\377`}, - quoteTest{"`\\`", `\`}, - quoteTest{"` `", ` `}, - quoteTest{"` `", ` `}, + {"``", ``}, + {"`a`", `a`}, + {"`abc`", `abc`}, + {"`☺`", `☺`}, + {"`hello world`", `hello world`}, + {"`\\xFF`", `\xFF`}, + {"`\\377`", `\377`}, + {"`\\`", `\`}, + {"` `", ` `}, + {"` `", ` `}, } var misquoted = []string{ |