BUGFIX: Jump operations skipping an operation once maxJumps reached.

This commit is contained in:
n1474335 2017-03-01 21:20:42 +00:00
parent 3ad4291258
commit 70603be5ab
2 changed files with 45 additions and 2 deletions

View file

@ -128,7 +128,6 @@ var FlowControl = {
maxJumps = ings[1]; maxJumps = ings[1];
if (state.numJumps >= maxJumps) { if (state.numJumps >= maxJumps) {
state.progress++;
return state; return state;
} }
@ -156,7 +155,6 @@ var FlowControl = {
maxJumps = ings[2]; maxJumps = ings[2];
if (state.numJumps >= maxJumps) { if (state.numJumps >= maxJumps) {
state.progress++;
return state; return state;
} }

View file

@ -64,4 +64,49 @@ TestRegister.addTests([
{"op":"To Base64", "args":["A-Za-z0-9+/="]} {"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,
],
},
],
},
]); ]);