mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
v2.8.1.1
This commit is contained in:
@@ -42,11 +42,8 @@ public class Pfunc_scrib_lib implements Scrib_lib {
|
||||
public boolean Expr(Scrib_proc_args args, Scrib_proc_rslt rslt) {
|
||||
byte[] expr_bry = args.Pull_bry(0);
|
||||
Bry_bfr tmp_bfr = core.Wiki().Utl__bfr_mkr().Get_b128();
|
||||
boolean pass = Pfunc_expr.Evaluate(tmp_bfr, core.Ctx(), expr_bry);
|
||||
Pfunc_expr.Evaluate(tmp_bfr, core.Ctx(), expr_bry);
|
||||
String expr_rslt = tmp_bfr.To_str_and_rls();
|
||||
if (pass)
|
||||
return rslt.Init_obj(expr_rslt);
|
||||
else
|
||||
throw Err_.new_wo_type(expr_rslt);
|
||||
return rslt.Init_obj(expr_rslt); // NOTE: always return rslt; don't throw error even if expr is invalid; EX:mw.ParserFuntion.expr('fail'); PAGE:es.w:Freer_(Texas) DATE:2015-07-28
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,10 @@ public class Pfunc_scrib_lib_tst {
|
||||
lib.Init();
|
||||
lib.Core_(fxt.Core());
|
||||
} private Scrib_invoke_func_fxt fxt = new Scrib_invoke_func_fxt(); private Pfunc_scrib_lib lib;
|
||||
@Test public void Expr() {
|
||||
@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__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>");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user