implement double quotes with escape characters

Mentioned in #60.
This commit is contained in:
Gokcehan committed 2017-02-11 14:42:47 +03:00
1 parent b790c53838
commit 397d4102e6
2 files changed
+65 -1

No files matched your search

+31 -1
View File
@@ -41,6 +41,36 @@ var gEvalTests = []struct {
[]expr{&callExpr{"echo", []string{"hello world"}}},
},
{
`echo "hello world"`,
[]string{"echo", "hello world", "\n"},
[]expr{&callExpr{"echo", []string{"hello world"}}},
},
{
`echo "hello\"world"`,
[]string{"echo", `hello"world`, "\n"},
[]expr{&callExpr{"echo", []string{`hello"world`}}},
},
{
`echo "hello\tworld"`,
[]string{"echo", "hello\tworld", "\n"},
[]expr{&callExpr{"echo", []string{"hello\tworld"}}},
},
{
`echo "hello\nworld"`,
[]string{"echo", "hello\nworld", "\n"},
[]expr{&callExpr{"echo", []string{"hello\nworld"}}},
},
{
`echo "hello\zworld"`,
[]string{"echo", "helloworld", "\n"},
[]expr{&callExpr{"echo", []string{"helloworld"}}},
},
{
`echo hello\ world`,
[]string{"echo", "hello world", "\n"},
@@ -60,7 +90,7 @@ var gEvalTests = []struct {
},
{
`echo hello\aworld`,
`echo hello\zworld`,
[]string{"echo", "helloworld", "\n"},
[]expr{&callExpr{"echo", []string{"helloworld"}}},
},