Add more escaping tests.
diff --git a/shell_test.go b/shell_test.go
index c729410..2559a49 100644
--- a/shell_test.go
+++ b/shell_test.go
@@ -48,7 +48,14 @@
{"\t", nil, true},
{"\n ", nil, true},
- // Leading and trailing whitespace are discarded.
+ // Various escape sequences work properly.
+ {`\ `, []string{" "}, true},
+ {`a\ `, []string{"a "}, true},
+ {`\\a`, []string{`\a`}, true},
+ {`"a\"b"`, []string{`a"b`}, true},
+ {`'\'`, []string{"\\"}, true},
+
+ // Leading and trailing whitespace are discarded correctly.
{"a", []string{"a"}, true},
{" a", []string{"a"}, true},
{"a\n", []string{"a"}, true},
@@ -71,9 +78,11 @@
{"'' a", []string{"", "a"}, true},
// Unbalanced quotation marks and escapes are detected.
- {"\\", []string{""}, false},
- {"'", []string{""}, false},
- {`"`, []string{""}, false},
+ {"\\", []string{""}, false}, // escape without a target
+ {"'", []string{""}, false}, // unclosed single
+ {`"`, []string{""}, false}, // unclosed double
+ {`'\''`, []string{`\`}, false}, // unclosed connected double
+ {`"\\" '`, []string{`\`, ``}, false}, // unclosed separate single
{"a 'b c", []string{"a", "b c"}, false},
{`a "b c`, []string{"a", "b c"}, false},
{`a "b \"`, []string{"a", `b "`}, false},