mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
37 lines
1.6 KiB
Java
37 lines
1.6 KiB
Java
|
/*
|
||
|
XOWA: the XOWA Offline Wiki Application
|
||
|
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||
|
|
||
|
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||
|
or alternatively under the terms of the Apache License Version 2.0.
|
||
|
|
||
|
You may use XOWA according to either of these licenses as is most appropriate
|
||
|
for your project on a case-by-case basis.
|
||
|
|
||
|
The terms of each license can be found in the source code repository:
|
||
|
|
||
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||
|
*/
|
||
|
package gplx.xowa.mediawiki.includes.title; import gplx.*; import gplx.xowa.*; import gplx.xowa.mediawiki.*; import gplx.xowa.mediawiki.includes.*;
|
||
|
import org.junit.*; import gplx.core.tests.*; import gplx.core.btries.*; import gplx.xowa.mediawiki.includes.parsers.*;
|
||
|
public class XomwMediaWikiTitleCodecTest {
|
||
|
private final XomwMediaWikiTitleCodecFxt fxt = new XomwMediaWikiTitleCodecFxt();
|
||
|
@Test public void regexTitlePrefix() {
|
||
|
// no match
|
||
|
fxt.Test_regexTitlePrefix("a" , "a", null);
|
||
|
// ns
|
||
|
fxt.Test_regexTitlePrefix("a:b" , "a", "b");
|
||
|
// underscores
|
||
|
fxt.Test_regexTitlePrefix("a__:___b" , "a", "b");
|
||
|
}
|
||
|
}
|
||
|
class XomwMediaWikiTitleCodecFxt {
|
||
|
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));
|
||
|
Gftest.Eq__str(expd_ns, String_.new_u8(regexTitlePrefixResult[0]));
|
||
|
Gftest.Eq__str(expd_ttl, String_.new_u8(regexTitlePrefixResult[1]));
|
||
|
}
|
||
|
}
|