From 4d995451a7a0ee1eee4f830eb264169b08ace1c9 Mon Sep 17 00:00:00 2001 From: David DE CARVALHO Date: Fri, 14 Apr 2023 09:52:26 +0200 Subject: [PATCH] [ISSUE 173] correction of unit tests :( --- .../avoidTryCatchFinallyCheck_NOK_FailsAllTryStatements.php | 4 ++-- .../src/test/resources/checks/avoidTryCatchFinallyCheck.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/php-plugin/src/test/resources/checks/avoidTryCatchFinallyCheck_NOK_FailsAllTryStatements.php b/php-plugin/src/test/resources/checks/avoidTryCatchFinallyCheck_NOK_FailsAllTryStatements.php index 22a44564c..1698df424 100644 --- a/php-plugin/src/test/resources/checks/avoidTryCatchFinallyCheck_NOK_FailsAllTryStatements.php +++ b/php-plugin/src/test/resources/checks/avoidTryCatchFinallyCheck_NOK_FailsAllTryStatements.php @@ -7,7 +7,7 @@ function test() { throw new SpecificException('Oopsie'); } -try // NOK {{Avoid using try-catch-finally}} +try // NOK {{Avoid using try-catch}} { $picture = PDF_open_image_file($PDF, "jpeg", $imgFile, "", 0); // This is the original statement, this works on PHP4 } @@ -17,7 +17,7 @@ function test() { throw new Exception($msg); } -try { // NOK {{Avoid using try-catch-finally}} +try { // NOK {{Avoid using try-catch}} throw new \Exception("Hello"); } catch(\Exception $e) { echo $e->getMessage()." catch in\n"; diff --git a/python-plugin/src/test/resources/checks/avoidTryCatchFinallyCheck.py b/python-plugin/src/test/resources/checks/avoidTryCatchFinallyCheck.py index a026587ed..1e24bb491 100644 --- a/python-plugin/src/test/resources/checks/avoidTryCatchFinallyCheck.py +++ b/python-plugin/src/test/resources/checks/avoidTryCatchFinallyCheck.py @@ -6,7 +6,7 @@ def my_function(): x=0 - try: # Noncompliant {{Avoid the use of try-catch-finally}} + try: # Noncompliant {{Avoid the use of try-catch}} print(x) except: print("Something went wrong") @@ -14,7 +14,7 @@ def my_function(): print("The 'try except' is finished") def foo(): - try: # Noncompliant {{Avoid the use of try-catch-finally}} + try: # Noncompliant {{Avoid the use of try-catch}} f = open(path) print(f.read()) except: