aboutsummaryrefslogtreecommitdiff
path: root/tests/lexer
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lexer')
-rw-r--r--tests/lexer/driver.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/lexer/driver.cxx b/tests/lexer/driver.cxx
index fb5efc3..e3543da 100644
--- a/tests/lexer/driver.cxx
+++ b/tests/lexer/driver.cxx
@@ -63,7 +63,7 @@ main ()
assert (lex (" foo\\") == tokens ({"<lexer error>"}));
- // Quoting.
+ // Quoting ''.
//
assert (lex ("''") == tokens ({"", ""}));
assert (lex ("'foo'") == tokens ({"foo", ""}));
@@ -79,6 +79,28 @@ main ()
assert (lex ("'foo bar") == tokens ({"<lexer error>"}));
+ // Quoting "".
+ //
+ assert (lex ("\"\"") == tokens ({"", ""}));
+ assert (lex ("\"foo\"") == tokens ({"foo", ""}));
+ assert (lex ("\"foo bar\"") == tokens ({"foo bar", ""}));
+ assert (lex ("\"foo \"bar") == tokens ({"foo bar", ""}));
+ assert (lex ("foo\" bar\"") == tokens ({"foo bar", ""}));
+ assert (lex ("\"foo \"\"bar\"") == tokens ({"foo bar", ""}));
+ assert (lex ("foo\" \"bar") == tokens ({"foo bar", ""}));
+ assert (lex ("\"foo\nbar\"") == tokens ({"foo\nbar", ""}));
+ assert (lex ("\"#:{}()=+\n\"") == tokens ({"#:{}()=+\n", ""}));
+ assert (lex ("\"'\"") == tokens ({"'", ""}));
+ assert (lex ("\"\\\"") == tokens ({"\\", ""}));
+
+ assert (lex ("\"$\"") == tokens ({"", "$", "", ""}));
+ assert (lex ("\"foo$bar\"") == tokens ({"foo", "$", "bar", ""}));
+ assert (lex ("foo\"$\"bar") == tokens ({"foo", "$", "bar", ""}));
+ assert (lex ("f\"oo$ba\"r") == tokens ({"foo", "$", "bar", ""}));
+
+ assert (lex ("\"foo bar") == tokens ({"<lexer error>"}));
+ assert (lex ("\"foo $bar") == tokens ({"foo ", "$", "<lexer error>"}));
+
// Combinations.
//
assert (lex ("foo: bar") == tokens ({"foo", ":", "bar", ""}));