diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-08 16:42:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-08 16:42:24 +0200 |
commit | ccca13f8eadef31f2df873cb505ebca98501c45a (patch) | |
tree | d87b67fd42909dfc5cca2ae2a999de8f8e0cc969 /tests/lexer/driver.cxx | |
parent | b5940dd5562bfa12d6d76dceb61540b4480a4982 (diff) |
Initial take on double quote support
Currently, $(foo)-style variable expansion is not supported.
Diffstat (limited to 'tests/lexer/driver.cxx')
-rw-r--r-- | tests/lexer/driver.cxx | 24 |
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", ""})); |