Fix test cases.

This commit is contained in:
Qi Xiao 2016-04-13 13:16:25 +02:00
parent 35147b3a7e
commit 89c9c5ac93
2 changed files with 4 additions and 3 deletions

View File

@ -13,7 +13,7 @@ var reprTests = []struct {
want string
}{
{String("233"), "233"},
{String("a\nb"), "'a\nb'"},
{String("a\nb"), `"a\nb"`},
{String("foo bar"), "'foo bar'"},
{String("a\x00b"), `"a\x00b"`},
{Bool(true), "$true"},

View File

@ -10,12 +10,13 @@ var quoteTests = []struct {
// Bareword when possible.
{"x-y,z@h/d", "x-y,z@h/d"},
// Single quote when there is special char but no unprintable.
{"x$y[]\nef'", "'x$y[]\nef'''"},
{"x$y[]ef'", "'x$y[]ef'''"},
// Tilde needs quoting only when appearing at the beginning
{"~x", "'~x'"},
{"x~", "x~"},
// Double quote when there is unprintable char.
{"\x1b\"\\", `"\x1b\"\\"`},
{"a\nb", `"a\nb"`},
{"\x1b\"\\", `"\e\"\\"`},
}
func TestQuote(t *testing.T) {