From fdf5ab34b9d87a72d0680caddf62116118a6cbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=99=BD=E4=BA=91?= <71159641+littlewhitecloud@users.noreply.github.com> Date: Sat, 16 Dec 2023 15:01:00 +0800 Subject: [PATCH] add three tests --- tests/syntax_error/missing_end_quote_in_byte.jou | 6 ++++++ tests/syntax_error/missing_end_quote_in_string.jou | 6 ++++++ tests/syntax_error/string_continue_on_next_line.jou | 8 ++++++++ 3 files changed, 20 insertions(+) create mode 100644 tests/syntax_error/missing_end_quote_in_byte.jou create mode 100644 tests/syntax_error/missing_end_quote_in_string.jou create mode 100644 tests/syntax_error/string_continue_on_next_line.jou diff --git a/tests/syntax_error/missing_end_quote_in_byte.jou b/tests/syntax_error/missing_end_quote_in_byte.jou new file mode 100644 index 00000000..52fe3caf --- /dev/null +++ b/tests/syntax_error/missing_end_quote_in_byte.jou @@ -0,0 +1,6 @@ +import "stdlib/io.jou" + +# Output: compiler error in file "tests/syntax_error/missing_end_quote_in_byte.jou", line 5: missing ' to end the byte literal +def main() -> int: + printf('?) + return 0 diff --git a/tests/syntax_error/missing_end_quote_in_string.jou b/tests/syntax_error/missing_end_quote_in_string.jou new file mode 100644 index 00000000..a860da4c --- /dev/null +++ b/tests/syntax_error/missing_end_quote_in_string.jou @@ -0,0 +1,6 @@ +import "stdlib/io.jou" + +# Output: compiler error in file "tests/syntax_error/missing_end_quote_in_string.jou", line 5: missing " to end the string +def main() -> int: + printf("Hello) + return 0 diff --git a/tests/syntax_error/string_continue_on_next_line.jou b/tests/syntax_error/string_continue_on_next_line.jou new file mode 100644 index 00000000..c9fc5d5d --- /dev/null +++ b/tests/syntax_error/string_continue_on_next_line.jou @@ -0,0 +1,8 @@ +import "stdlib/io.jou" + +# Output: compiler error in file "tests/syntax_error/string_continue_on_next_line.jou", line 5: missing ' to end the byte literal +def main() -> int: + a = '\ + 't\'' + printf(a) + return 0