1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

'v3.5.1.1'

This commit is contained in:
gnosygnu
2016-05-01 21:06:12 -04:00
parent 5ce4ea2a08
commit 96636f3161
131 changed files with 2287 additions and 928 deletions

View File

@@ -241,6 +241,7 @@ public class Pf_func_ {
, Xol_kwd_grp_.Id_rev_revisionsize
, Xol_kwd_grp_.Id_pagebanner
, Xol_kwd_grp_.Id_rev_protectionexpiry
, Xol_kwd_grp_.Id_categorytree
};
public static Xot_defn Get_prototype(int id) {
switch (id) {
@@ -408,6 +409,7 @@ public class Pf_func_ {
case Xol_kwd_grp_.Id_insider: return gplx.xowa.xtns.insiders.Insider_func.Instance;
case Xol_kwd_grp_.Id_massMessage_target: return gplx.xowa.xtns.massMessage.Message_target_func.Instance;
case Xol_kwd_grp_.Id_categorytree: return gplx.xowa.xtns.categorytrees.Categorytree_func.Instance;
case Xol_kwd_grp_.Id_pendingChangeLevel: return gplx.xowa.xtns.flaggedRevs.Pending_change_level_func.Instance;
case Xol_kwd_grp_.Id_pagesUsingPendingChanges: return gplx.xowa.xtns.flaggedRevs.Pages_using_pending_changes_func.Instance;

View File

@@ -18,12 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package gplx.xowa.xtns.pfuncs.ifs; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*; import gplx.xowa.xtns.pfuncs.*;
import org.junit.*;
public class Pfunc_if_tst {
private final Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
@Before public void init() {fxt.Reset();}
@Test public void If_y() {fxt.Test_parse_tmpl_str_test("{{#if:1|a|b}}" , "{{test}}" , "a");}
@Test public void If_n() {fxt.Test_parse_tmpl_str_test("{{#if:|a|b}}" , "{{test}}" , "b");}
@Test public void If_n() {fxt.Test_parse_tmpl_str_test("{{#if:|a|b}}" , "{{test}}" , "b");}
@Test public void If_n_ws() {fxt.Test_parse_tmpl_str_test("{{#if: |a|b}}" , "{{test}}" , "b");}
@Test public void If_y_ws() {fxt.Test_parse_tmpl_str_test("{{#if: |a|b \n}}" , "{{test}}" , "b");}
@Test public void If_y_ws() {fxt.Test_parse_tmpl_str_test("{{#if: |a|b \n}}" , "{{test}}" , "b");}
@Test public void If_y_ws1() {fxt.Test_parse_tmpl_str_test("{{#if: |a|{{#if: |a|b}}\n}}" , "{{test}}" , "b");}
@Test public void If_prm_n() {fxt.Test_parse_tmpl_str_test("{{#if:{{{1|}}}|{{{1}}}|b}}" , "{{test}}" , "b");}
@Test public void If_prm_y() {fxt.Test_parse_tmpl_str_test("{{#if:{{{1|}}}|{{{1}}}|b}}" , "{{test|a}}" , "a");}
@@ -31,7 +31,7 @@ public class Pfunc_if_tst {
@Test public void If_prm_nest_0() {fxt.Test_parse_tmpl_str_test("{{#if:{{{1|}}}|{{#if:{{{2|}}}|a|b}}|c}}" , "{{test}}" , "c");}
@Test public void If_prm_nest_1() {fxt.Test_parse_tmpl_str_test("{{#if:{{{1|}}}|{{#if:{{{2|}}}|a|b}}|c}}" , "{{test|1}}" , "b");}
@Test public void If_prm_nest_2() {fxt.Test_parse_tmpl_str_test("{{#if:{{{1|}}}|{{#if:{{{2|}}}|a|b}}|c}}" , "{{test|1|2}}" , "a");}
@Test public void If_ignore_key() {fxt.Test_parse_tmpl_str_test("{{#if:|<i id=1|<i id=2}}" , "{{test}}" , "<i id=2");}
@Test public void If_ignore_key() {fxt.Test_parse_tmpl_str_test("{{#if:|<i id=1|<i id=2}}" , "{{test}}" , "<i id=2");}
@Test public void If_newline() { // PURPOSE: new_line in comments; WP:[[redirect-distinguish|a|b]]
fxt.Test_parse_tmpl_str_test(String_.Concat_lines_nl_skip_last
( "{{#if:1<!--"

View File

@@ -38,9 +38,9 @@ public class Pfunc_scrib_lib implements Scrib_lib {
}
private static final int Proc_expr = 0;
public static final String Invk_expr = "expr";
private static final String[] Proc_names = String_.Ary(Invk_expr);
private static final String[] Proc_names = String_.Ary(Invk_expr);
public boolean Expr(Scrib_proc_args args, Scrib_proc_rslt rslt) {
byte[] expr_bry = args.Pull_bry(0);
byte[] expr_bry = args.Xstr_bry_or_null(0); // NOTE: some modules will pass in an int; PAGE:en.w:531_BC DATE:2016-04-29
Bry_bfr tmp_bfr = core.Wiki().Utl__bfr_mkr().Get_b128();
Pfunc_expr.Evaluate(tmp_bfr, core.Ctx(), expr_bry);
String expr_rslt = tmp_bfr.To_str_and_rls();

View File

@@ -28,6 +28,9 @@ public class Pfunc_scrib_lib_tst {
@Test public void Expr__pass() {
fxt.Test_scrib_proc_str(lib, Pfunc_scrib_lib.Invk_expr, Object_.Ary("1 + 2") , "3");
}
@Test public void Expr__int() {
fxt.Test_scrib_proc_str(lib, Pfunc_scrib_lib.Invk_expr, Object_.Ary(3) , "3"); // int should not cause class cast error; PAGE:en.w:531_BC; DATE:2016-04-29
}
@Test public void Expr__fail() { // PURPOSE: if bad input don't throw error; return error message; PAGE:es.w:Freer_(Texas) DATE:2015-07-28
fxt.Test_scrib_proc_str(lib, Pfunc_scrib_lib.Invk_expr, Object_.Ary("fail") , "<strong class=\"error\">Expression error: Unrecognised word \"fail\"</strong>");
}