mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Test: Add utility core.Page_url for easier logging; also do not run cfg during tests
This commit is contained in:
parent
1cde843264
commit
74b63d5f08
@ -32,6 +32,7 @@ public class Xocfg_mgr implements Gfo_invk {
|
||||
public void Bind_many_app (Gfo_invk sub, String... keys) {Bind_many(Bool_.Y, sub, Xocfg_mgr.Ctx__app, keys);}
|
||||
public void Bind_many_wiki (Gfo_invk sub, Xow_wiki wiki, String... keys) {Bind_many(Bool_.Y, sub, wiki.Domain_itm().Abrv_xo_str(), keys);}
|
||||
private void Bind_many(boolean pub, Gfo_invk sub, String ctx, String... keys) {
|
||||
if (gplx.core.envs.Env_.Mode_testing()) return;
|
||||
for (String key : keys) {
|
||||
try {
|
||||
cache_mgr.Sub(sub, ctx, key, key);
|
||||
|
@ -25,6 +25,7 @@ public class Scrib_core {
|
||||
public Scrib_core(Xoae_app app, Xop_ctx ctx) {// NOTE: ctx needed for language reg
|
||||
this.app = app; this.ctx = ctx;
|
||||
this.wiki = ctx.Wiki(); this.page = ctx.Page(); // NOTE: wiki / page needed for title reg; DATE:2014-02-05
|
||||
this.page_url = page.Url_bry_safe();
|
||||
this.lang = wiki.Lang();
|
||||
this.Engine_(Scrib_engine_type.Type_lua, false); // TEST: default to lua
|
||||
fsys_mgr.Root_dir_(app.Fsys_mgr().Bin_xtns_dir().GenSubDir_nest("Scribunto"));
|
||||
@ -45,6 +46,7 @@ public class Scrib_core {
|
||||
public Xol_lang_itm Lang() {return lang;} private Xol_lang_itm lang;
|
||||
@gplx.Internal protected void Wiki_(Xowe_wiki v) {this.wiki = v;} // TEST:
|
||||
public Xoae_page Page() {return page;} private Xoae_page page;
|
||||
public byte[] Page_url() {return page_url;} private byte[] page_url;
|
||||
public boolean Enabled() {return enabled;} private boolean enabled = true;
|
||||
public void Engine_(Scrib_engine v) {this.engine = v;}
|
||||
private void Engine_(byte type, boolean luaj_debug_enabled) {
|
||||
@ -92,6 +94,7 @@ public class Scrib_core {
|
||||
mods.Clear(); // clear any loaded modules
|
||||
Xow_wiki wiki = page.Wiki();
|
||||
this.page = page;
|
||||
this.page_url = page.Url_bry_safe();
|
||||
byte[] new_wiki = wiki.Domain_bry();
|
||||
if (!Bry_.Eq(cur_wiki, new_wiki)) {
|
||||
cur_wiki = new_wiki;
|
||||
|
@ -16,7 +16,7 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
package gplx.xowa.xtns.scribunto; import gplx.*; import gplx.xowa.*; import gplx.xowa.xtns.*;
|
||||
import org.junit.*;
|
||||
public class Scrib_err_filter_mgr_tst {
|
||||
@Before public void init() {fxt.Clear();} private final Scrib_err_filter_mgr_fxt fxt = new Scrib_err_filter_mgr_fxt();
|
||||
@Before public void init() {fxt.Clear();} private final Scrib_err_filter_mgr_fxt fxt = new Scrib_err_filter_mgr_fxt();
|
||||
@Test public void Basic() {
|
||||
fxt.Exec_add(11, "Mod_1", "Fnc_1", "Err_11", "Comm_11");
|
||||
fxt.Exec_add(12, "Mod_1", "Fnc_2", "Err_12", "Comm_12");
|
||||
@ -34,7 +34,7 @@ public class Scrib_err_filter_mgr_tst {
|
||||
}
|
||||
}
|
||||
class Scrib_err_filter_mgr_fxt {
|
||||
private final Scrib_err_filter_mgr err_mgr = new Scrib_err_filter_mgr();
|
||||
private final Scrib_err_filter_mgr err_mgr = new Scrib_err_filter_mgr();
|
||||
public void Clear() {err_mgr.Clear();}
|
||||
public void Exec_add(int expd, String mod, String fnc, String err, String comment) {err_mgr.Add(expd, mod, fnc, err, comment);}
|
||||
public void Test_match_y(String mod, String fnc, String err) {Test_match(Bool_.Y, mod, fnc, err);}
|
||||
|
Loading…
Reference in New Issue
Block a user