From c6015a88c7313fbbc72e154049e07da0499848f1 Mon Sep 17 00:00:00 2001 From: Bill Ruddock Date: Sun, 14 Jul 2024 01:19:43 +0100 Subject: [PATCH 1/2] Squiz/ForLoopDeclaration: rename js test case file to allow for adding more --- ...DeclarationUnitTest.js => ForLoopDeclarationUnitTest.1.js} | 0 ...nitTest.js.fixed => ForLoopDeclarationUnitTest.1.js.fixed} | 0 .../Tests/ControlStructures/ForLoopDeclarationUnitTest.php | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename src/Standards/Squiz/Tests/ControlStructures/{ForLoopDeclarationUnitTest.js => ForLoopDeclarationUnitTest.1.js} (100%) rename src/Standards/Squiz/Tests/ControlStructures/{ForLoopDeclarationUnitTest.js.fixed => ForLoopDeclarationUnitTest.1.js.fixed} (100%) diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js similarity index 100% rename from src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js rename to src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js.fixed b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js.fixed similarity index 100% rename from src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.js.fixed rename to src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js.fixed diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php index 82c653957d..265e89eef6 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php @@ -67,7 +67,7 @@ public function getErrorList($testFile='') 116 => 2, ]; - case 'ForLoopDeclarationUnitTest.js': + case 'ForLoopDeclarationUnitTest.1.js': return [ 6 => 2, 9 => 2, @@ -125,7 +125,7 @@ public function getWarningList($testFile='') case 'ForLoopDeclarationUnitTest.3.inc': return [6 => 1]; - case 'ForLoopDeclarationUnitTest.js': + case 'ForLoopDeclarationUnitTest.1.js': return [125 => 1]; default: From 53a5f7919d19f29d8bd253e5600d77148bf36a56 Mon Sep 17 00:00:00 2001 From: Bill Ruddock Date: Sun, 14 Jul 2024 01:27:27 +0100 Subject: [PATCH 2/2] Squiz/ForLoopDeclaration: move js parse error to its own file --- .../Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js | 3 --- .../ControlStructures/ForLoopDeclarationUnitTest.1.js.fixed | 3 --- .../Tests/ControlStructures/ForLoopDeclarationUnitTest.2.js | 2 ++ .../Tests/ControlStructures/ForLoopDeclarationUnitTest.php | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) create mode 100644 src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.2.js diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js index 3023a644f9..94e1f7484f 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js @@ -120,6 +120,3 @@ for ( // Test with semicolon not belonging to for. for (i = function() {self.widgetLoaded(widget.id) ; }; i < function() {self.widgetLoaded(widget.id);}; i++) {} for (i = function() {self.widgetLoaded(widget.id);}; i < function() {self.widgetLoaded(widget.id);} ; i++) {} - -// This test has to be the last one in the file! Intentional parse error check. -for diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js.fixed b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js.fixed index dcfd03bdc2..fbf9b60980 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js.fixed +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.1.js.fixed @@ -86,6 +86,3 @@ for ( i = 0; i < 10; i++ ) {} // Test with semicolon not belonging to for. for (i = function() {self.widgetLoaded(widget.id) ; }; i < function() {self.widgetLoaded(widget.id);}; i++) {} for (i = function() {self.widgetLoaded(widget.id);}; i < function() {self.widgetLoaded(widget.id);}; i++) {} - -// This test has to be the last one in the file! Intentional parse error check. -for diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.2.js b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.2.js new file mode 100644 index 0000000000..c05d2092eb --- /dev/null +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.2.js @@ -0,0 +1,2 @@ +// Intentional parse error check. Live coding resilience. +for diff --git a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php index 265e89eef6..90b29021bb 100644 --- a/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php +++ b/src/Standards/Squiz/Tests/ControlStructures/ForLoopDeclarationUnitTest.php @@ -125,8 +125,8 @@ public function getWarningList($testFile='') case 'ForLoopDeclarationUnitTest.3.inc': return [6 => 1]; - case 'ForLoopDeclarationUnitTest.1.js': - return [125 => 1]; + case 'ForLoopDeclarationUnitTest.2.js': + return [2 => 1]; default: return [];