From 70603be5abdfd4249cbb265391c7a05f80d48666 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Wed, 1 Mar 2017 21:20:42 +0000 Subject: [PATCH] BUGFIX: Jump operations skipping an operation once maxJumps reached. --- src/js/core/FlowControl.js | 2 -- test/tests/operations/FlowControl.js | 45 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/js/core/FlowControl.js b/src/js/core/FlowControl.js index 6f56be66..dc2db7d5 100755 --- a/src/js/core/FlowControl.js +++ b/src/js/core/FlowControl.js @@ -128,7 +128,6 @@ var FlowControl = { maxJumps = ings[1]; if (state.numJumps >= maxJumps) { - state.progress++; return state; } @@ -156,7 +155,6 @@ var FlowControl = { maxJumps = ings[2]; if (state.numJumps >= maxJumps) { - state.progress++; return state; } diff --git a/test/tests/operations/FlowControl.js b/test/tests/operations/FlowControl.js index d960e5b5..59c7f965 100644 --- a/test/tests/operations/FlowControl.js +++ b/test/tests/operations/FlowControl.js @@ -64,4 +64,49 @@ TestRegister.addTests([ {"op":"To Base64", "args":["A-Za-z0-9+/="]} ] }, + { + name: "Conditional Jump: Skips 0", + input: [ + "match", + "should be changed 1", + "should be changed 2", + ].join("\n"), + expectedOutput: [ + "match", + "should be changed 1 was changed", + "should be changed 2 was changed" + ].join("\n"), + recipeConfig: [ + { + op: "Conditional Jump", + args: ["match", 0, 0], + }, + { + op: "Find / Replace", + args: [ + { + "option": "Regex", + "string": "should be changed 1" + }, + "should be changed 1 was changed", + true, + true, + true, + ], + }, + { + op: "Find / Replace", + args: [ + { + "option": "Regex", + "string": "should be changed 2" + }, + "should be changed 2 was changed", + true, + true, + true, + ], + }, + ], + }, ]);