From 566090f2e1c3a6c3e0c635462fd86bbc6e03804d Mon Sep 17 00:00:00 2001 From: kiokuless Date: Tue, 18 Jul 2023 23:44:20 +0900 Subject: [PATCH] Add a test that goto statements are not parsed as variable declarations --- tests/test_run.py | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tests/test_run.py b/tests/test_run.py index e3381f5..c8caa7e 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -1,14 +1,14 @@ -# ############################################################################ # +# **************************************************************************** # # # # ::: :::::::: # # test_run.py :+: :+: :+: # # +:+ +:+ +:+ # -# By: charles +#+ +:+ +#+ # +# By: kiokuless +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2021/02/08 19:56:48 by charles #+# #+# # -# Updated: 2021/02/11 20:27:07 by charles ### ########.fr # +# Updated: 2023/07/18 23:42:04 by kiokuless ### ########.fr # # # -# ############################################################################ # +# **************************************************************************** # import pytest @@ -82,3 +82,29 @@ def test_basic(): } """ assert output == run_all(input) + +def test_goto_statement(): + input = """ +int main(void) +{ + int i; + int i = 0; + while(i < 10) + i++; + goto ok; + return (0); +} +""" + output = """ +int\tmain(void) +{ + int i; + + i = 0; + while (i < 10) + i++; + goto ok; + return (0); +} +""" + assert output == run_all(input)