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

'v3.7.2.1'

This commit is contained in:
gnosygnu
2016-07-10 23:35:32 -04:00
parent f5f48bb9b1
commit b333db45f8
366 changed files with 4468 additions and 3460 deletions

View File

@@ -0,0 +1,33 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.wikis.ttls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import org.junit.*;
public class Xoa_ttl__err_tst {
@Before public void init() {fxt.Clear();} private final Xoa_ttl_fxt fxt = new Xoa_ttl_fxt();
@Test public void Invalid__angle() {fxt.Parse("<!--a").Test__null();}
@Test public void Invalid__brace() {fxt.Parse("[[a]]").Test__null();}
@Test public void Invalid__curly() {fxt.Parse("{{a}}").Test__null();}
@Test public void Colon_is_last() {fxt.Parse("Help:").Test__null();}
@Test public void Len_max() {fxt.Parse(String_.Repeat("A", 512)).Test__page_txt(String_.Repeat("A", 512));}
@Test public void Len_0() {
fxt.Parse("").Test__null();
fxt.Parse(" ").Test__null();
fxt.Parse("_").Test__null();
fxt.Parse("_ _").Test__null();
}
}

View File

@@ -0,0 +1,35 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.wikis.ttls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.core.tests.*;
public class Xoa_ttl_fxt {
private Xowe_wiki wiki;
private String raw;
private Xoa_ttl ttl;
public void Clear() {
Xoae_app app = Xoa_app_fxt.Make__app__edit();
this.wiki = Xoa_app_fxt.Make__wiki__edit(app);
}
public Xoa_ttl_fxt Parse(String raw) {
this.raw = raw;
this.ttl = Xoa_ttl.Parse(wiki, Bry_.new_u8(raw));
return this;
}
public void Test__null() {Gftest.Eq__bool_y(ttl == null, "ttl is not null", "raw", raw);}
public void Test__page_txt(String expd) {Gftest.Eq__str(expd, String_.new_u8(ttl.Page_txt()), "page_txt", "raw", raw);}
}

View File

@@ -1,57 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.wikis.ttls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import gplx.core.log_msgs.*;
public class Xop_ttl_log {
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "ttl");
public static final Gfo_msg_itm
Len_0 = Gfo_msg_itm_.new_warn_(owner, "Len_0")
, Len_max = Gfo_msg_itm_.new_warn_(owner, "Len_max")
, Ttl_has_ns_but_no_page = Gfo_msg_itm_.new_warn_(owner, "Ttl_has_ns_but_no_page")
, Ttl_is_ns_only = Gfo_msg_itm_.new_warn_(owner, "Ttl_is_ns_only")
, Amp_unknown = Gfo_msg_itm_.new_warn_(owner, "Amp_unknown")
, Comment_eos = Gfo_msg_itm_.new_warn_(owner, "Comment_eos")
, Invalid_char = Gfo_msg_itm_.new_warn_(owner, "Invalid_char")
;
}
class Xop_redirect_log {
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "redirect");
public static final Gfo_msg_itm
False_match = Gfo_msg_itm_.new_warn_(owner, "False_match")
, Lnki_not_found = Gfo_msg_itm_.new_warn_(owner, "Lnki_not_found")
;
}
class Xop_tag_log {
private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "tag");
public static final Gfo_msg_itm
Invalid = Gfo_msg_itm_.new_warn_(owner, "Invalid")
;
}
// class Pf_func_lang_log {
// private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "tmpl_func_lang");
// public static final Gfo_msg_itm
// Arg_out_of_bounds = Gfo_msg_itm_.new_warn_(owner, "Arg_out_of_bounds")
// ;
// }
// class Mwl_expr_log {
// private static final Gfo_msg_grp owner = Gfo_msg_grp_.new_(Xoa_app_.Nde, "expr");
// public static final Gfo_msg_itm
// Divide_by_zero = Gfo_msg_itm_.new_warn_(owner, "Divide_by_zero")
// , Expr_len0 = Gfo_msg_itm_.new_warn_(owner, "Expr_len0")
// ;
// }

View File

@@ -1,39 +0,0 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa.wikis.ttls; import gplx.*; import gplx.xowa.*; import gplx.xowa.wikis.*;
import org.junit.*;
public class Xow_ttl__err_tst {
@Before public void init() {fxt.Reset();} private Xow_ttl_fxt fxt = new Xow_ttl_fxt();
@Test public void Invalid() {fxt.Init_ttl("<!--A").Expd_err(Xop_ttl_log.Comment_eos).Test();}
@Test public void Invalid_brace() {fxt.Init_ttl("[[a]]").Expd_err(Xop_ttl_log.Invalid_char).Test();}
@Test public void Invalid_curly() {fxt.Init_ttl("{{a}}").Expd_err(Xop_ttl_log.Invalid_char).Test();}
@Test public void Len_0() {
fxt.Init_ttl("").Expd_err(Xop_ttl_log.Len_0).Test();
fxt.Init_ttl(" ").Expd_err(Xop_ttl_log.Len_0).Test();
fxt.Init_ttl("_").Expd_err(Xop_ttl_log.Len_0).Test();
fxt.Init_ttl("_ _").Expd_err(Xop_ttl_log.Len_0).Test();
}
@Test public void Len_max() {
fxt.Init_ttl(String_.Repeat("A", 512)).Expd_page_txt(String_.Repeat("A", 512)).Test();
// fxt.Init_ttl("File:" + String_.Repeat("A", 255)).Expd_page_txt(String_.Repeat("A", 255)).Test(); // DELETE: removing multi-byte check; DATE:2013-02-02
// fxt.Init_ttl(String_.Repeat("A", 256)).Expd_err(Xop_ttl_log.Len_max).Test();
// fxt.Init_ttl("Special:" + String_.Repeat("A", 255)).Expd_ns_id(Xow_ns_.Tid__special).Expd_page_txt(String_.Repeat("A", 255)).Test();
// fxt.Init_ttl("Special:" + String_.Repeat("A", 512 + 8)).Expd_err(Xop_ttl_log.Len_max).Test(); // 8="Special:".length
}
@Test public void Colon_is_last_ns() {fxt.Init_ttl("Help:").Expd_err(Xop_ttl_log.Ttl_is_ns_only).Test();}
}

View File

@@ -57,7 +57,7 @@ class Xow_ttl_fxt {
fxt.Log_clear();
}
public void Test() {
Xoa_ttl actl = Xoa_ttl.parse(fxt.Wiki(), Bry_.new_u8(test_raw));
Xoa_ttl actl = Xoa_ttl.Parse(fxt.Wiki(), Bry_.new_u8(test_raw));
if (expd_err == null) {
if (expd_ns_id != Int_.Min_value) Tfds.Eq(expd_ns_id, actl.Ns().Id(), "ns");
if (expd_xwik_txt != null) Tfds.Eq(expd_xwik_txt, String_.new_u8(actl.Wik_txt()), "Wiki");