@ -31,38 +49,38 @@ public class Scrib_lib_ustring__gsub__tst {
// TOMBSTONE: tested with local MW and {{#invoke:Test|test16|a|[^]|b}} -> Lua error: Missing close-bracket for character set beginning at pattern character 1.; DATE:2018-07-02
// Exec_gsub("a" , "[^]" , 1, "b" , "a;0"); // invalid regx should not fail; should return self; DATE:2013-10-20
}
@TestpublicvoidFind__int(){// PURPOSE: gsub with integer arg should not fail; DATE:2013-11-06
@TestpublicvoidFind__int(){// PURPOSE: gsub with integer arg should not fail; DATE:2013-11-06
fxt.Test__proc__kvps__flat(lib,Scrib_lib_ustring.Invk_gsub,Scrib_kv_utl_.base1_many_(1,"[1]","2",1),"2;1");// NOTE: text is integer (lua / php are type-less)
}
@TestpublicvoidReplace__none(){// PURPOSE: gsub with no replace argument should not fail; EX:d:'orse; DATE:2013-10-14
@TestpublicvoidReplace__none(){// PURPOSE: gsub with no replace argument should not fail; EX:d:'orse; DATE:2013-10-14
@TestpublicvoidReplace__int(){// PURPOSE: do not fail if integer is passed in for @replace; PAGE:en.d:λύω DATE:2014-09-02
@TestpublicvoidReplace__int(){// PURPOSE: do not fail if integer is passed in for @replace; PAGE:en.d:λύω DATE:2014-09-02
Exec_gsub("abcd",1,-1,1,"abcd;0");
}
@TestpublicvoidReplace__double(){// PURPOSE: do not fail if double is passed in for @replace; PAGE:de.v:Wikivoyage:Wikidata/Test_Modul:Wikidata2 DATE:2016-04-21
@TestpublicvoidReplace__double(){// PURPOSE: do not fail if double is passed in for @replace; PAGE:de.v:Wikivoyage:Wikidata/Test_Modul:Wikidata2 DATE:2016-04-21
Exec_gsub("abc","[ab]",-1,Scrib_kv_utl_.flat_many_("a","A"),"Abc;2");// PURPOSE: match not in regex should still print itself; in this case [c] is not in tbl regex; DATE:2014-03-31
}
@TestpublicvoidReplace__table__match(){// PURPOSE: replace using group, not found term; EX:"b" not "%b%" PAGE:en.w:Bannered_routes_of_U.S._Route_60; DATE:2014-08-15
@TestpublicvoidReplace__table__match(){// PURPOSE: replace using group, not found term; EX:"b" not "%b%" PAGE:en.w:Bannered_routes_of_U.S._Route_60; DATE:2014-08-15
Exec_gsub("aba",".",-1,proc.To_scrib_lua_proc(),"AbA;3");// fails if "Aba;3" whic means each that A was only matched once
}
@TestpublicvoidRegx__int(){// PURPOSE: do not fail if integer is passed in for @regx; PAGE:en.d:λύω DATE:2014-09-02
@TestpublicvoidRegx__int(){// PURPOSE: do not fail if integer is passed in for @regx; PAGE:en.d:λύω DATE:2014-09-02
Exec_gsub("abcd",1,-1,"A","abcd;0");
}
@TestpublicvoidRegx__dash(){// PURPOSE: "-" at end of regx should be literal; EX:[A-]; PAGE:en.d:frei DATE:2016-01-23
@TestpublicvoidRegx__dash(){// PURPOSE: "-" at end of regx should be literal; EX:[A-]; PAGE:en.d:frei DATE:2016-01-23
Exec_gsub("abc","[a-]",-1,"d","dbc;1");
}
@TestpublicvoidRegx__word_class(){// PURPOSE: handle %w in extended regex; PAGE:en.w:A♯_(musical_note) DATE:2015-06-10
@TestpublicvoidRegx__word_class(){// PURPOSE: handle %w in extended regex; PAGE:en.w:A♯_(musical_note) DATE:2015-06-10
Exec_gsub("(a b)","[^%w%p%s]",-1,"x","(a b);0");// was returning "(x x)" b/c ^%w was incorrectly matching "a" and "b"
}
@TestpublicvoidRegx__balanced_group(){// PURPOSE: handle balanced group regex; EX:"%b()"; NOTE:test will fail if run in 1.6 environment; DATE:2013-12-20
@TestpublicvoidRegx__balanced_group(){// PURPOSE: handle balanced group regex; EX:"%b()"; NOTE:test will fail if run in 1.6 environment; DATE:2013-12-20
Exec_gsub("a b c","%f[%W]",5,"()","a() b() c();3");
Exec_gsub("abC DEF gHI JKm NOP","%f[%a]%u+%f[%A]",Int_.Max_value,"()","abC () gHI JKm ();2");// based on http://lua-users.org/wiki/FrontierPattern
}
@TestpublicvoidRegx__frontier_pattern_utl(){// PURPOSE: standalone test for \0 logic in frontier pattern; note that verified against PHP: echo(preg_match( "/[\w]/us", "\0" )); DATE:2015-07-21
@TestpublicvoidRegx__frontier_pattern_utl(){// PURPOSE: standalone test for \0 logic in frontier pattern; note that verified against PHP: echo(preg_match( "/[\w]/us", "\0" )); DATE:2015-07-21
Tfds.Eq(Bool_.N,Regx_adp_.Match("\0","a"));// \0 not matched by a
Tfds.Eq(Bool_.N,Regx_adp_.Match("\0","0"));// \0 not matched by numeric 0
Tfds.Eq(Bool_.N,Regx_adp_.Match("\0","[\\w]"));// \0 not matched by word_char
@ -120,21 +138,23 @@ public class Scrib_lib_ustring__gsub__tst {
Tfds.Eq(Bool_.Y,Regx_adp_.Match("\0","[\\x]"));// \0 matched by any_char
Tfds.Eq(Bool_.Y,Regx_adp_.Match("\0","[\\X]"));// \0 matched by !any_char