From 616b38f2017a91f09339c84559f388c020d4fdd4 Mon Sep 17 00:00:00 2001 From: Niklas Hargarter Date: Mon, 3 Jun 2024 11:12:15 +0200 Subject: [PATCH] Change: Use correct NASL coding style in test case --- .../test_variable_redefinition_in_foreach.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/plugins/test_variable_redefinition_in_foreach.py b/tests/plugins/test_variable_redefinition_in_foreach.py index 3159b7bb..e08940b3 100644 --- a/tests/plugins/test_variable_redefinition_in_foreach.py +++ b/tests/plugins/test_variable_redefinition_in_foreach.py @@ -14,10 +14,10 @@ class CheckVariableRedefinitionInForeachTestCase(PluginTestCase): def test_ok(self): nasl_file = Path(__file__).parent / "test.nasl" content = ( - "urls = ['foo', 'bar']\n" - "foreach url ( urls ) {}\n" - "url1 = 'foo'\n" - "foreach url(make_list(url1,'bar'))" + 'urls = ["foo", "bar"];\n' + "foreach url(urls) {\n display(url);\n}\n" + 'url1 = "foo";\n' + 'foreach url(make_list(url1, "bar")) {\n display(url);\n}' ) fake_context = self.create_file_plugin_context( nasl_file=nasl_file, file_content=content @@ -30,9 +30,9 @@ def test_ok(self): def test_fail(self): nasl_file = Path(__file__).parent / "test.nasl" content = ( - "url1 = 'foo'\n" - "foreach url ( url ) {}\n" - "foreach url(make_list(url1,url)) {}\n" + 'url1 = "foo";\n' + "foreach url(url) {\n display(url);\n}\n" + "foreach url(make_list(url1, url)) {\n display(url);\n}\n" ) fake_context = self.create_file_plugin_context( nasl_file=nasl_file, file_content=content @@ -44,12 +44,12 @@ def test_fail(self): self.assertEqual( "The variable 'url' is redefined " "by being the identifier\nand the iterator in the" - " same foreach loop 'foreach url ( url )'", + " same foreach loop 'foreach url(url)'", results[0].message, ) self.assertEqual( "The variable 'url' is used as identifier and\n" "as part of the iterator in the" - " same foreach loop\n'foreach url(make_list(url1,url))'", + " same foreach loop\n'foreach url(make_list(url1, url))'", results[1].message, )