|
|
|
@ -145,6 +145,13 @@ public class Scrib_lib_ustring__gsub__tst {
|
|
|
|
|
fxt.Init__cbk(proc);
|
|
|
|
|
Exec_gsub(text, regx, -1, proc.To_scrib_lua_proc(), "aBYz;2");
|
|
|
|
|
}
|
|
|
|
|
@Test public void Luacbk__balanced() { // PURPOSE:LUAJ_PATTERN_REPLACEMENT; DATE:2019-04-16
|
|
|
|
|
String text = "}a{{b}}c{{d}}";
|
|
|
|
|
String regx = "%b{}"; // "()" is anypos, which inserts find_pos to results
|
|
|
|
|
Mock_proc__verify_args proc = new Mock_proc__verify_args(0, new Object[]{"x", "{{b}}"}, new Object[]{"y", "{{d}}"});
|
|
|
|
|
fxt.Init__cbk(proc);
|
|
|
|
|
Exec_gsub(text, regx, -1, proc.To_scrib_lua_proc(), "}axcy;2");
|
|
|
|
|
}
|
|
|
|
|
@Test public void Luacbk__anypos() {
|
|
|
|
|
String text = "ad2f1e3z";
|
|
|
|
|
String regx = "()([1d])([2e])([3f])"; // "()" is anypos, which inserts find_pos to results
|
|
|
|
@ -156,21 +163,14 @@ public class Scrib_lib_ustring__gsub__tst {
|
|
|
|
|
}
|
|
|
|
|
@Test public void Luacbk__frontier__eos() { // PURPOSE:frontier pattern should not match end of string; ISSUE#:732; DATE:2020-05-28
|
|
|
|
|
String text = "a";
|
|
|
|
|
String regx = "([a])(%f[%s])";
|
|
|
|
|
String expd = "a;0"; // fails if "b;0"
|
|
|
|
|
String regx = "(a)(%f[%s])";
|
|
|
|
|
String expd = "a;0"; // fails if "b;0" when below is uncommented
|
|
|
|
|
Mock_proc__verify_args proc = new Mock_proc__verify_args(0
|
|
|
|
|
//, new Object[]{"b", "a", ""} // NOTE: used to require these parameters
|
|
|
|
|
);
|
|
|
|
|
fxt.Init__cbk(proc);
|
|
|
|
|
Exec_gsub(text, regx, -1, proc.To_scrib_lua_proc(), expd);
|
|
|
|
|
}
|
|
|
|
|
@Test public void Luacbk__balanced() { // PURPOSE:LUAJ_PATTERN_REPLACEMENT; DATE:2019-04-16
|
|
|
|
|
String text = "}a{{b}}c{{d}}";
|
|
|
|
|
String regx = "%b{}"; // "()" is anypos, which inserts find_pos to results
|
|
|
|
|
Mock_proc__verify_args proc = new Mock_proc__verify_args(0, new Object[]{"x", "{{b}}"}, new Object[]{"y", "{{d}}"});
|
|
|
|
|
fxt.Init__cbk(proc);
|
|
|
|
|
Exec_gsub(text, regx, -1, proc.To_scrib_lua_proc(), "}axcy;2");
|
|
|
|
|
}
|
|
|
|
|
// Mock_proc__verify_args proc = new Mock_proc__verify_args(0, new Object[]{"x", "{{yes2}}"}, new Object[]{"x", "{{flagicon|USA}}"});
|
|
|
|
|
// fxt.Init__cbk(proc);
|
|
|
|
|
// Exec_gsub("}\n|-\n|28\n|{{yes2}}Win\n|28–0\n|style=\"text-align:left;\"|{{flagicon|USA}}", "%b{}", -1, proc.To_scrib_lua_proc(), "}axbx;2"); }
|
|
|
|
|