mirror of https://github.com/gnosygnu/xowa
Scribunto: Use PHP.empty for noCommafy [#372]
parent
3fd759b020
commit
3488084eca
@ -0,0 +1,44 @@
|
||||
/*
|
||||
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; import gplx.*; import gplx.xowa.*;
|
||||
import org.junit.*; import gplx.core.tests.*;
|
||||
public class XophpUtilityTest {
|
||||
private final XophpUtilityFxt fxt = new XophpUtilityFxt();
|
||||
@Test public void Empty_obj() {
|
||||
fxt.Test_empty_obj_y(""); // "" (an empty String)
|
||||
fxt.Test_empty_obj_y(0); // 0 (0 as an integer)
|
||||
fxt.Test_empty_obj_y(0.0d); // 0.0 (0 as a float)
|
||||
fxt.Test_empty_obj_y("0"); // "0" (0 as a String)
|
||||
fxt.Test_empty_obj_y(null); // NULL
|
||||
fxt.Test_empty_obj_y(false); // FALSE
|
||||
fxt.Test_empty_obj_y(new int[0]); // array() (an empty array)
|
||||
|
||||
fxt.Test_empty_obj_n(Bool_.Y);
|
||||
fxt.Test_empty_obj_n("a");
|
||||
fxt.Test_empty_obj_n(9);
|
||||
fxt.Test_empty_obj_n(0.8d);
|
||||
fxt.Test_empty_obj_n("7");
|
||||
fxt.Test_empty_obj_n(true);
|
||||
fxt.Test_empty_obj_n(new int[1]);
|
||||
}
|
||||
}
|
||||
class XophpUtilityFxt {
|
||||
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) {
|
||||
Gftest.Eq__bool(expd, XophpUtility.empty_obj(o), Object_.Xto_str_strict_or_empty(o));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue