From 0bb9ef6a85f3ee42904940bb63e6127c37a2bd2d Mon Sep 17 00:00:00 2001 From: GreasySlug <9619abgoni@gmail.com> Date: Fri, 16 Sep 2022 20:55:57 +0900 Subject: [PATCH] Test: additional testing of fixed issues Double quotation char is missing, so added it Added a test to see if the added escaping characters work --- compiler/erg_parser/tests/test1_basic_syntax.er | 2 +- compiler/erg_parser/tests/test3_literal_syntax.er | 2 +- compiler/erg_parser/tests/tokenize_test.rs | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/compiler/erg_parser/tests/test1_basic_syntax.er b/compiler/erg_parser/tests/test1_basic_syntax.er index ffd77c3f..8b8d5a9b 100644 --- a/compiler/erg_parser/tests/test1_basic_syntax.er +++ b/compiler/erg_parser/tests/test1_basic_syntax.er @@ -6,7 +6,7 @@ a, _, ...b = five_elem_tuple f x, y = x + y if! True, do!: - print! "\\hello, world\"" + print! "\"\\hello, world\\\"" 10.times! do!: if! x.y.z, do!: print! "" diff --git a/compiler/erg_parser/tests/test3_literal_syntax.er b/compiler/erg_parser/tests/test3_literal_syntax.er index 2bbae620..d9eb12d5 100644 --- a/compiler/erg_parser/tests/test3_literal_syntax.er +++ b/compiler/erg_parser/tests/test3_literal_syntax.er @@ -9,7 +9,7 @@ 0.00, -0.0, .1, 400. # Str Literal -"", "a", "こんにちは", "\" \\ " +"", "a", "こんにちは", "\"\\", "\"\'\\\0\r\n\t" # Boolean Litteral True, False diff --git a/compiler/erg_parser/tests/tokenize_test.rs b/compiler/erg_parser/tests/tokenize_test.rs index 47744926..6371de34 100644 --- a/compiler/erg_parser/tests/tokenize_test.rs +++ b/compiler/erg_parser/tests/tokenize_test.rs @@ -37,7 +37,7 @@ fn test_lexer_for_basic() -> ParseResult<()> { (Comma, ","), (UBar, "_"), (Comma, ","), - (Spread, "..."), // EllipsisLit + (EllipsisLit, "..."), (Symbol, "b"), (Equal, "="), (Symbol, "five_elem_tuple"), @@ -62,7 +62,7 @@ fn test_lexer_for_basic() -> ParseResult<()> { (Newline, newline), (Indent, " "), (Symbol, "print!"), - (StrLit, "\"\\\\hello, world\\\"\""), + (StrLit, "\"\"\\hello, world\\\"\""), (Newline, newline), (NatLit, "10"), (Dot, "."), @@ -264,7 +264,9 @@ fn test_lexer_for_literals() -> ParseResult<()> { (Comma, ","), (StrLit, "\"こんにちは\""), (Comma, ","), - (StrLit, "\"\\\" \\\\ \""), + (StrLit, "\"\"\\\""), + (Comma, ","), + (StrLit, "\"\"\'\\\0\r\n \""), (Newline, newline), (Newline, newline), (Newline, newline),