1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2024-09-28 14:30:51 +00:00

Dev: Rename test files to use '_tst' and '_fxt' convention [#512]

This commit is contained in:
gnosygnu 2019-07-22 21:51:24 -04:00
parent 877b305136
commit 9bc2bd400c
21 changed files with 58 additions and 58 deletions

View File

@ -15,13 +15,13 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
import org.junit.*; import gplx.core.tests.*;
public class XophpPregTest {
private final XophpPregFxt fxt = new XophpPregFxt();
public class XophpPreg_tst {
private final XophpPreg_fxt fxt = new XophpPreg_fxt();
@Test public void Basic() {fxt.Test_split("a''b''c" , "''", Bool_.Y, "a", "''", "b", "''", "c");}
@Test public void Extend() {fxt.Test_split("a'''b'''c" , "''", Bool_.Y, "a", "'''", "b", "'''", "c");}
@Test public void Eos() {fxt.Test_split("a''" , "''", Bool_.Y, "a", "''");}
}
class XophpPregFxt {
class XophpPreg_fxt {
private final gplx.core.primitives.Int_list rv = new gplx.core.primitives.Int_list();
public void Test_split(String src, String dlm, boolean extend, String... expd) {Test_split(src, 0, String_.Len(src), dlm, extend, expd);}
public void Test_split(String src, int src_bgn, int src_end, String dlm, boolean extend, String... expd) {

View File

@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
import org.junit.*; import gplx.core.tests.*; import gplx.core.btries.*;
public class XophpStringTest {
private final XophpStringFxt fxt = new XophpStringFxt();
public class XophpString_tst {
private final XophpString_fxt fxt = new XophpString_fxt();
@Test public void Strspn_fwd__byte() {
fxt.Test_strspn_fwd__byte("aaaaab", Byte_ascii.Ltr_a, 0, -1, 5); // basic
fxt.Test_strspn_fwd__byte("aaaaab", Byte_ascii.Ltr_a, 1, -1, 4); // bgn
@ -50,7 +50,7 @@ public class XophpStringTest {
fxt.Test_strtr_by_trie("ab_01" , "ab_89"); // EOS
}
}
class XophpStringFxt {
class XophpString_fxt {
public void Test_strspn_fwd__byte(String src_str, byte find, int bgn, int max, int expd) {
byte[] src_bry = Bry_.new_u8(src_str);
Gftest.Eq__int(expd, XophpString.strspn_fwd__byte(src_bry, find, bgn, max, src_bry.length));

View File

@ -25,7 +25,7 @@ public class XophpType {
public boolean is_array() {
return type_id == Type_ids_.Id__array;
}
public static XophpType New(Object o) {
public static XophpType New(Object o) {
return new XophpType(Type_ids_.To_id_by_obj(o));
}
}

View File

@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
import org.junit.*; import gplx.core.tests.*;
public class XophpUtilityTest {
private final XophpUtilityFxt fxt = new XophpUtilityFxt();
public class XophpUtility_tst {
private final XophpUtility_fxt fxt = new XophpUtility_fxt();
@Test public void Empty_obj() {
fxt.Test_empty_obj_y(""); // "" (an empty String)
fxt.Test_empty_obj_y(0); // 0 (0 as an integer)
@ -35,7 +35,7 @@ public class XophpUtilityTest {
fxt.Test_empty_obj_n(new int[1]);
}
}
class XophpUtilityFxt {
class XophpUtility_fxt {
public void Test_empty_obj_n(Object o) {Test_empty_obj(Bool_.N, o);}
public void Test_empty_obj_y(Object o) {Test_empty_obj(Bool_.Y, o);}
public void Test_empty_obj(boolean expd, Object o) {

View File

@ -16,8 +16,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
import org.junit.*; import gplx.core.tests.*;
import gplx.xowa.mediawiki.includes.xohtml.*;
public class XomwHtml_expandAttributesTest {
private final XomwHtml_expandAttributesFxt fxt = new XomwHtml_expandAttributesFxt();
public class XomwHtml_expandAttributes_tst{
private final XomwHtml_expandAttributes_fxt fxt = new XomwHtml_expandAttributes_fxt();
@Test public void Basic() {
fxt.Test__expand_attributes(" a=\"b\"", "a", "b");
}
@ -25,7 +25,7 @@ public class XomwHtml_expandAttributesTest {
fxt.Test__expand_attributes("", "a", null);
}
}
class XomwHtml_expandAttributesFxt {
class XomwHtml_expandAttributes_fxt {
private final Bry_bfr bfr = Bry_bfr_.New();
private final XomwHtmlTemp temp = new XomwHtmlTemp();
public void Test__expand_attributes(String expd, String... kvs) {

View File

@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
import org.junit.*; import gplx.core.tests.*;
public class XomwLinker_NormalizeSubpageLinkTest {
private final XomwLinker_NormalizeSubpageLinkFxt fxt = new XomwLinker_NormalizeSubpageLinkFxt();
public class XomwLinker_NormalizeSubpageLink_tst {
private final XomwLinker_NormalizeSubpageLink_fxt fxt = new XomwLinker_NormalizeSubpageLink_fxt();
@Test public void None() {fxt.Test__normalize_subpage_link("A/B/C" , "Z" , "" , "Z" , "");}
@Test public void Hash() {fxt.Test__normalize_subpage_link("A/B/C" , "/Y#Z" , "" , "A/B/C/Y#Z" , "/Y#Z");}
@Test public void Slash__basic() {fxt.Test__normalize_subpage_link("A/B/C" , "/Z" , "" , "A/B/C/Z" , "/Z");}
@ -25,11 +25,11 @@ public class XomwLinker_NormalizeSubpageLinkTest {
@Test public void Dot2__many() {fxt.Test__normalize_subpage_link("A/B/C" , "../../Z" , "z1" , "A/Z" , "z1");}
@Test public void Dot2__trailing() {fxt.Test__normalize_subpage_link("A/B/C" , "../../Z/" , "" , "A/Z" , "Z");}
}
class XomwLinker_NormalizeSubpageLinkFxt {
class XomwLinker_NormalizeSubpageLink_fxt {
private final XomwEnv env;
private final XomwLinker mgr = new XomwLinker(new gplx.xowa.mediawiki.includes.linkers.XomwLinkRenderer(new XomwSanitizer()));
private final XomwLinker_NormalizeSubpageLink normalize_subpage_link = new XomwLinker_NormalizeSubpageLink();
public XomwLinker_NormalizeSubpageLinkFxt() {
public XomwLinker_NormalizeSubpageLink_fxt() {
this.env = XomwEnv.NewTest();
}
public void Test__normalize_subpage_link(String page_title_str, String link, String text, String expd_link, String expd_text) {

View File

@ -15,15 +15,15 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
import org.junit.*; import gplx.core.tests.*; import gplx.core.btries.*; import gplx.xowa.mediawiki.includes.parsers.*;
public class XomwLinker_SplitTrailTest {
private final XomwLinker_SplitTrailFxt fxt = new XomwLinker_SplitTrailFxt();
public class XomwLinker_SplitTrail_tst {
private final XomwLinker_SplitTrail_fxt fxt = new XomwLinker_SplitTrail_fxt();
@Test public void Basic() {fxt.Test__split_trail("abc def" , "abc" , " def");}
@Test public void None() {fxt.Test__split_trail(" abc" , null , " abc");}
}
class XomwLinker_SplitTrailFxt {
class XomwLinker_SplitTrail_fxt {
private final XomwLinker linker = new XomwLinker(new gplx.xowa.mediawiki.includes.linkers.XomwLinkRenderer(new XomwSanitizer()));
private final Btrie_slim_mgr trie = Btrie_slim_mgr.cs();
public XomwLinker_SplitTrailFxt() {
public XomwLinker_SplitTrail_fxt() {
String[] ary = new String[] {"a", "b", "c", "d", "e", "f"};
for (String itm : ary)
trie.Add_str_str(itm, itm);

View File

@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
import org.junit.*; import gplx.core.tests.*;
public class XomwMagicWordArrayTest {
private final XomwMagicWordArrayFxt fxt = new XomwMagicWordArrayFxt();
public class XomwMagicWordArray_tst {
private final XomwMagicWordArray_fxt fxt = new XomwMagicWordArray_fxt();
@Test public void Nil() {
fxt.Init__word(Bool_.Y, "img_nil", "nil");
fxt.Init__ary("img_nil");
@ -44,7 +44,7 @@ public class XomwMagicWordArrayTest {
fxt.Test__matchVariableStartToEnd("123px", "img_width", "123");
}
}
class XomwMagicWordArrayFxt {
class XomwMagicWordArray_fxt {
private final XomwMagicWordMgr magic_word_mgr = new XomwMagicWordMgr();
private XomwMagicWordArray magic_word_ary;
public void Init__word(boolean cs, String word, String... synonyms) {

View File

@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
import org.junit.*; import gplx.core.tests.*; import gplx.core.btries.*; import gplx.xowa.mediawiki.includes.xohtml.*;
public class XomwSanitizerTest {
private final XomwSanitizerFxt fxt = new XomwSanitizerFxt();
public class XomwSanitizer_tst {
private final XomwSanitizer_fxt fxt = new XomwSanitizer_fxt();
@Test public void Normalize__text() {fxt.Test__normalize_char_references("abc" , "abc");}
@Test public void Normalize__dec() {fxt.Test__normalize_char_references("" , "");}
@Test public void Normalize__dec__invalid() {fxt.Test__normalize_char_references("	" , "	");}
@ -129,7 +129,7 @@ public class XomwSanitizerTest {
fxt.Test_normalizeWhitespace("a\tb", "a b");
}
}
class XomwSanitizerFxt {
class XomwSanitizer_fxt {
private final XomwSanitizer sanitizer = new XomwSanitizer();
private final Bry_bfr tmp = Bry_bfr_.New();
public void Test__normalize_char_references(String src_str, String expd) {

View File

@ -15,12 +15,12 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki.includes; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
import org.junit.*; import gplx.core.tests.*;
public class XomwTitleTest {
private final XomwTitleFxt fxt = new XomwTitleFxt();
public class XomwTitle_tst {
private final XomwTitle_fxt fxt = new XomwTitle_fxt();
@Test public void Alphanum() {fxt.Test__find_fwd_while_title("0aB" , 3);}
@Test public void Angle() {fxt.Test__find_fwd_while_title("0a<" , 2);}
}
class XomwTitleFxt {
class XomwTitle_fxt {
public void Test__find_fwd_while_title(String src_str, int expd) {
byte[] src_bry = Bry_.new_u8(src_str);
Gftest.Eq__int(expd, XomwTitle.Find_fwd_while_title(src_bry, 0, src_bry.length, XomwTitle.Title_chars_valid()));

View File

@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki.includes.libs; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
import org.junit.*; import gplx.core.tests.*;
public class XomwStringUtilsTest {
private final XomwStringUtilsFxt fxt = new XomwStringUtilsFxt();
public class XomwStringUtils_tst {
private final XomwStringUtils_fxt fxt = new XomwStringUtils_fxt();
@Test public void Delimiter_explode() {
// basic
fxt.Test_delimiter_explode("a|b|c" , "a", "b", "c");
@ -52,7 +52,7 @@ public class XomwStringUtilsTest {
fxt.Test_delimiterReplace("/*", "*/", "a/*0*/1*/c" , "9", "a91*/c");
}
}
class XomwStringUtilsFxt {
class XomwStringUtils_fxt {
public void Test_delimiter_explode(String src_str, String... expd) {
List_adp tmp = List_adp_.New();
gplx.core.btries.Btrie_rv trv = new gplx.core.btries.Btrie_rv();

View File

@ -18,7 +18,7 @@ import org.junit.*; import gplx.core.tests.*;
import gplx.xowa.mediawiki.includes.parsers.*; import gplx.xowa.mediawiki.includes.parsers.lnkis.*;
import gplx.xowa.mediawiki.includes.filerepo.*; import gplx.xowa.mediawiki.includes.filerepo.file.*;
import gplx.xowa.mediawiki.languages.*;
public class XomwImageHandlerTest {
public class XomwImageHandler_tst {
private final XomwImageHandler_fxt fxt = new XomwImageHandler_fxt();
@Before public void init() {
fxt.Init__file("A.png", 400, 200);

View File

@ -16,8 +16,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
package gplx.xowa.mediawiki.includes.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
import org.junit.*; import gplx.core.tests.*;
import gplx.xowa.mediawiki.includes.linkers.*;
public class XomwBlockLevelPassTest {
private final XomwBlockLevelPassFxt fxt = new XomwBlockLevelPassFxt();
public class XomwBlockLevelPass_tst {
private final XomwBlockLevelPass_fxt fxt = new XomwBlockLevelPass_fxt();
@Test public void Basic() {
fxt.Test__do_block_levels(String_.Concat_lines_nl_skip_last
( "a"
@ -27,7 +27,7 @@ public class XomwBlockLevelPassTest {
));
}
}
class XomwBlockLevelPassFxt {
class XomwBlockLevelPass_fxt {
private final XomwBlockLevelPass block_level_pass = new XomwBlockLevelPass();
private final XomwParserCtx pctx = new XomwParserCtx();
private final XomwParserBfr pbfr = new XomwParserBfr();

View File

@ -16,19 +16,19 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
package gplx.xowa.mediawiki.includes.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
import org.junit.*; import gplx.core.tests.*;
import gplx.xowa.mediawiki.includes.linkers.*;
public class XomwLinkHolderArrayTest {
private final XomwLinkHolderArrayFxt fxt = new XomwLinkHolderArrayFxt();
public class XomwLinkHolderArray_tst {
private final XomwLinkHolderArray_fxt fxt = new XomwLinkHolderArray_fxt();
@Test public void Replace__basic() {
fxt.Init__add("A", "a");
fxt.Test__replace("a <!--LINK 0--> b", "a <a href='/wiki/A' title='A'>a</a> b");
}
}
class XomwLinkHolderArrayFxt {
class XomwLinkHolderArray_fxt {
private final XomwEnv env;
private final XomwLinkHolderArray holders;
private final XomwParserBfr pbfr = new XomwParserBfr();
private boolean apos = true;
public XomwLinkHolderArrayFxt() {
public XomwLinkHolderArray_fxt() {
XomwParser parser = new XomwParser(XomwEnv.NewTest());
this.env = parser.Env();
this.holders = new XomwLinkHolderArray(parser);

View File

@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki.includes.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
import org.junit.*;
public class XomwParserTest {
private final XomwParserFxt fxt = new XomwParserFxt();
public class XomwParser_tst {
private final XomwParser_fxt fxt = new XomwParser_fxt();
@Test public void Basic() {
fxt.Test__parse(String_.Concat_lines_nl_skip_last
( "== heading_1 =="
@ -57,11 +57,11 @@ public class XomwParserTest {
));
}
}
class XomwParserFxt {
class XomwParser_fxt {
private final XomwParser parser;
private final XomwParserCtx pctx = new XomwParserCtx();
private final XomwParserBfr pbfr = new XomwParserBfr();
public XomwParserFxt() {
public XomwParser_fxt() {
Xoae_app app = Xoa_app_fxt.Make__app__edit();
Xowe_wiki wiki = Xoa_app_fxt.Make__wiki__edit(app);
this.parser = new XomwParser(XomwEnv.NewTestByApp(app));

View File

@ -162,7 +162,7 @@ class XomwPreprocessor_Hash extends XomwPreprocessor { private XophpArray accum
// for ( $stack->stack as $piece ) {
// array_splice( $stack->rootAccum, count( $stack->rootAccum ), 0, $piece->breakSyntax() );
// }
// // Enable top-level headings
// for ( $stack->rootAccum as &$node ) {
// if ( is_array( $node ) && $node[PPNode_Hash_Tree::NAME] === 'possible-h' ) {
@ -170,7 +170,7 @@ class XomwPreprocessor_Hash extends XomwPreprocessor { private XophpArray accum
// }
// }
XophpArray rootStore = XophpArray.New(XophpArray.New("root", stack.Get_root_accum()));
XomwPPNode_Hash_Tree rootNode = new XomwPPNode_Hash_Tree(rootStore, 0);

View File

@ -107,7 +107,7 @@ public class XomwPreprocessor__tst {
}
@Test public void Ext__unclosed() { // COVERS: "Infinite backtrack"
fxt.Test__parse("a<pre bcd", "<root>a&lt;pre bcd</root>");
}
}
@Test public void Ext__noinclude() { // COVERS: "<includeonly> and <noinclude> just become <ignore> tags"
fxt.Init__for_inclusion_(Bool_.N);
fxt.Test__parse("a<includeonly>b<noinclude>c</noinclude>d</includeonly>e", "<root>a<ignore>&lt;includeonly&gt;b&lt;noinclude&gt;c&lt;/noinclude&gt;d&lt;/includeonly&gt;</ignore>e</root>");

View File

@ -15,8 +15,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
*/
package gplx.xowa.mediawiki.includes.parsers; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
import org.junit.*; import gplx.core.tests.*;
public class XomwStripStateTest {
private final XomwStripStateFxt fxt = new XomwStripStateFxt();
public class XomwStripState_tst {
private final XomwStripState_fxt fxt = new XomwStripState_fxt();
@Test public void Basic() {
fxt.Init__add (XomwStripState.TYPE_GENERAL, "\u007f'\"`UNIQ-key-1-QINU`\"'\u007f", "val-1");
fxt.Test__nostrip(XomwStripState.TYPE_NOWIKI , "a \u007f'\"`UNIQ-key-1-QINU`\"'\u007f b");
@ -29,7 +29,7 @@ public class XomwStripStateTest {
fxt.Test__unstrip(XomwStripState.TYPE_GENERAL, "a \u007f'\"`UNIQ-key-2-QINU`\"'\u007f b", "a val-1 b");
}
}
class XomwStripStateFxt {
class XomwStripState_fxt {
private final XomwStripState stripState = new XomwStripState();
public void Init__add(byte tid, String marker, String val) {
stripState.addItem(tid, Bry_.new_u8(marker), Bry_.new_u8(val));

View File

@ -18,8 +18,8 @@ import org.junit.*; import gplx.core.tests.*;
import gplx.core.btries.*;
import gplx.xowa.mediawiki.includes.parsers.*;
import gplx.xowa.mediawiki.languages.*; import gplx.xowa.langs.*;
public class XomwMediaWikiTitleCodecTest {
private final XomwMediaWikiTitleCodecFxt fxt = new XomwMediaWikiTitleCodecFxt();
public class XomwMediaWikiTitleCodec_tst {
private final XomwMediaWikiTitleCodec_fxt fxt = new XomwMediaWikiTitleCodec_fxt();
@Test public void regexTitlePrefix() {
// no match
fxt.Test_regexTitlePrefix("a" , "a", null);
@ -34,7 +34,7 @@ public class XomwMediaWikiTitleCodecTest {
fxt.Test_splitTitleString(codec, "File:A" , fxt.Make_parts(XomwDefines.NS_FILE, "A"));
}
}
class XomwMediaWikiTitleCodecFxt {
class XomwMediaWikiTitleCodec_fxt {
private byte[][] regexTitlePrefixResult = new byte[2][];
public void Test_regexTitlePrefix(String src, String expd_ns, String expd_ttl) {
XomwRegexTitlePrefix.preg_match(regexTitlePrefixResult, Bry_.new_u8(src));

View File

@ -16,8 +16,8 @@ Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
package gplx.xowa.mediawiki.languages; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*;
import org.junit.*; import gplx.core.tests.*;
import gplx.xowa.langs.*;
public class XomwLanguageTest {
private final XomwLanguageFxt fxt = new XomwLanguageFxt();
public class XomwLanguage_tst {
private final XomwLanguage_fxt fxt = new XomwLanguage_fxt();
@Test public void Commafy_standard() {
// basic
fxt.Test_commafy("1" , "1");
@ -113,9 +113,9 @@ public class XomwLanguageTest {
fxt.Test_commafy("-1234567890" , "-1,23,45,67,890");
}
}
class XomwLanguageFxt {
class XomwLanguage_fxt {
private final XomwLanguage lang;
public XomwLanguageFxt() {
public XomwLanguage_fxt() {
Xoae_app app = Xoa_app_fxt.Make__app__edit();
Xol_lang_itm xoLang = app.Lang_mgr().Get_by_or_load(Bry_.new_a7("en"));
this.lang = new XomwLanguage(xoLang);