Skip to content

Commit

Permalink
Change: Use correct NASL coding style in test case
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasHargarter authored and mbrinkhoff committed Jun 11, 2024
1 parent 661a2fa commit 616b38f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/plugins/test_variable_redefinition_in_foreach.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
)

0 comments on commit 616b38f

Please sign in to comment.