From d00d062af2743832c22e3fdff7c88db894cf59d8 Mon Sep 17 00:00:00 2001 From: Tom Collins Date: Mon, 8 May 2017 17:24:29 -0700 Subject: tests/basics/lexer: Add lexer tests for input starting with newlines. --- tests/basics/lexer.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/basics/lexer.py') diff --git a/tests/basics/lexer.py b/tests/basics/lexer.py index 5f12afa70..f1602f5de 100644 --- a/tests/basics/lexer.py +++ b/tests/basics/lexer.py @@ -9,6 +9,14 @@ exec("\n") exec("\n\n") exec("\r") exec("\r\r") +exec("\t") +exec("\r\n") +exec("\nprint(1)") +exec("\rprint(2)") +exec("\r\nprint(3)") +exec("\n5") +exec("\r6") +exec("\r\n7") print(eval("1")) print(eval("12")) print(eval("123")) -- cgit v1.2.3 From 760aa0996f29ae33a36c48128dd8f74597b877ad Mon Sep 17 00:00:00 2001 From: Tom Collins Date: Tue, 9 May 2017 13:17:04 -0700 Subject: tests/basics/lexer: Add line continuation tests for lexer. Tests for an issue with line continuation failing in paste mode due to the lexer only checking for \n in the "following" character position, before next_char() has had a chance to convert \r and \r\n to \n. --- tests/basics/lexer.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/basics/lexer.py') diff --git a/tests/basics/lexer.py b/tests/basics/lexer.py index f1602f5de..244de8cb9 100644 --- a/tests/basics/lexer.py +++ b/tests/basics/lexer.py @@ -27,6 +27,14 @@ print(eval("1\r")) print(eval("12\r")) print(eval("123\r")) +# line continuation +print(eval("'123' \\\r '456'")) +print(eval("'123' \\\n '456'")) +print(eval("'123' \\\r\n '456'")) +print(eval("'123'\\\r'456'")) +print(eval("'123'\\\n'456'")) +print(eval("'123'\\\r\n'456'")) + # backslash used to escape a line-break in a string print('a\ b') -- cgit v1.2.3