1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2016-01-03 21:27:38 -05:00
parent 9509363f46
commit 096045614c
647 changed files with 11693 additions and 7648 deletions

View File

@@ -16,22 +16,20 @@ 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.*;
import org.junit.*; import gplx.xowa.wikis.nss.*;
public class Xow_ttl__anchor_tst {
@Before public void init() {fxt.Reset();} private Xow_ttl_fxt fxt = new Xow_ttl_fxt();
@Test public void Anch_y() {fxt.Init_ttl("a#b") .Expd_full_txt("A").Expd_page_txt("A").Expd_anch_txt("b").Test();}
@Test public void Anch_only() {fxt.Init_ttl("#a") .Expd_full_txt("").Expd_page_txt("").Expd_anch_txt("a").Test();}
@Test public void Anchor_fails() { // PURPOSE: :#batch:Main Page causes ttl to fail b/c # is treated as anchor; DATE:2013-01-02
@Test public void Page__main() {fxt.Init_ttl("a#b") .Expd_full_txt("A").Expd_page_txt("A").Expd_anch_txt("b").Test();}
@Test public void Page__ns() {fxt.Init_ttl("Help:A#B") .Expd_full_txt("Help:A").Expd_ns_id(Xow_ns_.Tid__help).Expd_page_txt("A").Expd_anch_txt("B").Test();}
@Test public void Pageless__main() {fxt.Init_ttl("#a") .Expd_full_txt("").Expd_page_txt("").Expd_anch_txt("a").Test();}
@Test public void Xwiki() { // PURPOSE: :#batch:Main Page causes ttl to fail b/c # is treated as anchor; DATE:2013-01-02
fxt.Wiki().Xwiki_mgr().Add_by_atrs(Bry_.new_a7("#batch"), Bry_.new_a7("none"));
fxt.Init_ttl(":#batch:Main Page").Expd_full_txt("Main Page").Test();
}
@Test public void Anchor_angles() {// PURPOSE: angles in anchor should be encoded; DATE: 2013-01-23
@Test public void Anch_has_angles() {// PURPOSE: angles in anchor should be encoded; DATE: 2013-01-23
fxt.Init_ttl("A#b<c>d").Expd_full_txt("A").Expd_anch_txt("b.3Cc.3Ed").Test();
}
@Test public void Anchor_arg_in_non_main_ns() {
fxt.Init_ttl("Help:A#B").Expd_full_txt("Help:A").Expd_anch_txt("B").Test();
}
@Test public void Anchor_and_slash() { // PURPOSE: slash in anchor was being treated as a subpage; DATE:2014-01-14
@Test public void Anch_has_slash() { // PURPOSE: slash in anchor was being treated as a subpage; DATE:2014-01-14
fxt.Init_ttl("A#b/c").Expd_full_txt("A").Expd_anch_txt("b/c").Expd_leaf_txt("A").Test(); // NOTE: Leaf_txt should be Page_txt; used to fail
}
@Test public void Decode_ncr() { // PURPOSE: convert &#x23; to #; PAGE:en.s:The_English_Constitution_(1894) DATE:2014-09-07
@@ -39,4 +37,7 @@ public class Xow_ttl__anchor_tst {
fxt.Init_ttl("A&#35;b").Expd_full_txt("A").Expd_page_txt("A").Expd_anch_txt("b").Test();
fxt.Init_ttl("A&#36;b").Expd_full_txt("A$b").Expd_page_txt("A$b").Expd_anch_txt("").Test();
}
@Test public void Multiple() {// PURPOSE: handle multiple anchors; en.w:Grand_Central_Terminal; DATE:2015-12-31
fxt.Init_ttl("A#b#c").Expd_page_txt("A").Expd_anch_txt("b#c").Test();
}
}

View File

@@ -21,13 +21,13 @@ import gplx.xowa.langs.cases.*;
public class Xow_ttl__i18n_tst {
@Before public void init() {fxt.Reset();} private Xow_ttl_fxt fxt = new Xow_ttl_fxt();
@Test public void Bidi() { // PURPOSE: handle bidirectional characters; DATE:2015-07-28; DATE:2015-08-24
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0x8E)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0x8F)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAA)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAB)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAC)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAD)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.new_ints(0xE2, 0x80, 0xAE)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0x8E)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0x8F)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAA)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAB)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAC)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAD)) + "B").Expd_page_txt("AB").Test();
fxt.Init_ttl("A" + String_.new_u8(Bry_.New_by_ints(0xE2, 0x80, 0xAE)) + "B").Expd_page_txt("AB").Test();
}
@Test public void Multi_byte_char2() { // PURPOSE: multi-byte HTML entity causes array out of index error; EX: w:List_of_Unicode_characters; DATE:2013-12-25
fxt.Init_ttl("&#x2c65;").Expd_full_txt("").Test();

View File

@@ -18,7 +18,7 @@ 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.*;
class Xow_ttl_fxt {
private Xop_fxt fxt = new Xop_fxt();
private final Xop_fxt fxt = new Xop_fxt();
public Xow_ttl_fxt Init_ttl(String raw) {test_raw = raw; return this;} private String test_raw = "";
public Xow_ttl_fxt Expd_ns_id(int v) {expd_ns_id = v; return this;} private int expd_ns_id = Int_.Min_value;
public Xow_ttl_fxt Expd_page_txt(String v) {expd_page_txt = v; return this;} private String expd_page_txt;