mirror of
https://github.com/gnosygnu/xowa.git
synced 2025-05-31 22:44:34 +00:00
XOMW: More XomwHooks implementation [#632]
This commit is contained in:
parent
0c3cb1ba3d
commit
a6b128422e
@ -1,18 +1,18 @@
|
|||||||
/*
|
/*
|
||||||
XOWA: the XOWA Offline Wiki Application
|
XOWA: the XOWA Offline Wiki Application
|
||||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||||
|
|
||||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
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.
|
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
|
You may use XOWA according to either of these licenses as is most appropriate
|
||||||
for your project on a case-by-case basis.
|
for your project on a case-by-case basis.
|
||||||
|
|
||||||
The terms of each license can be found in the source code repository:
|
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
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
|
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
|
||||||
import gplx.core.brys.*;
|
import gplx.core.brys.*;
|
||||||
// NOTE: Object-representation of PHP Array; REF.PHP: https://www.php.net/manual/en/language.types.array.php
|
// NOTE: Object-representation of PHP Array; REF.PHP: https://www.php.net/manual/en/language.types.array.php
|
||||||
|
@ -247,4 +247,29 @@ public class XophpArray_ {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// REF.PHP: https://www.php.net/manual/en/function.array-shift.php
|
||||||
|
// Returns the shifted value, or NULL if array is empty or is not an array.
|
||||||
|
public static Object array_shift(XophpArray array) {
|
||||||
|
if (array == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
int len = array.Len();
|
||||||
|
if (len == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
XophpArrayItm[] itms = array.To_ary();
|
||||||
|
array.Clear();
|
||||||
|
int idx = 0;
|
||||||
|
for (int i = 1; i < len; i++) {
|
||||||
|
XophpArrayItm itm = itms[i];
|
||||||
|
if (itm.Key_is_int()) {
|
||||||
|
array.Add(idx++, itm.Val());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
array.Add(itm.Key(), itm.Val());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return itms[0].Val();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -19,9 +19,8 @@ package gplx.xowa.mediawiki.includes;
|
|||||||
import gplx.xowa.mediawiki.*;
|
import gplx.xowa.mediawiki.*;
|
||||||
/*
|
/*
|
||||||
TODO:
|
TODO:
|
||||||
* $wgHooks
|
* class XophpClosure: https://www.php.net/manual/en/class.closure.php
|
||||||
* array_shift
|
* array_filter: https://www.php.net/manual/en/function.array-filter.php
|
||||||
* Closure?
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,9 +77,7 @@ public class XomwHooks {
|
|||||||
* @return bool True if the hook has a function registered to it
|
* @return bool True if the hook has a function registered to it
|
||||||
*/
|
*/
|
||||||
public static boolean isRegistered(String name) {
|
public static boolean isRegistered(String name) {
|
||||||
// global $wgHooks;
|
return !XophpObject_.empty_obj(XomwDefaultSettings.wgHooks.Get_by(name)) || !XophpObject_.empty_obj(handlers.Get_by(name));
|
||||||
// return !XophpArray_.empty($wgHooks[$name]) || !XophpArray_.empty(handlers[$name]);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,17 +90,14 @@ public class XomwHooks {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static XophpArray getHandlers(String name) {
|
public static XophpArray getHandlers(String name) {
|
||||||
// global $wgHooks;
|
|
||||||
|
|
||||||
if (!isRegistered(name)) {
|
if (!isRegistered(name)) {
|
||||||
return XophpArray.New();
|
return XophpArray.New();
|
||||||
// } else if (!XophpArray_.isset(handlers, name)) {
|
} else if (!XophpArray_.isset(handlers, name)) {
|
||||||
// return $wgHooks[name];
|
return XomwDefaultSettings.wgHooks.Get_by_ary(name);
|
||||||
// } else if (!isset($wgHooks[name])) {
|
} else if (!XophpArray_.isset(XomwDefaultSettings.wgHooks, name)) {
|
||||||
// return handlers[name];
|
return handlers.Get_by_ary(name);
|
||||||
} else {
|
} else {
|
||||||
// return XophpArray_.array_merge(handlers.Get_by_ary(name), $wgHooks[name]);
|
return XophpArray_.array_merge(handlers.Get_by_ary(name), XomwDefaultSettings.wgHooks.Get_by_ary(name));
|
||||||
return XophpArray_.array_merge(handlers.Get_by_ary(name));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
XOWA: the XOWA Offline Wiki Application
|
XOWA: the XOWA Offline Wiki Application
|
||||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
Copyright (C) 2012-2020 gnosygnu@gmail.com
|
||||||
|
|
||||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
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.
|
or alternatively under the terms of the Apache License Version 2.0.
|
||||||
@ -13,273 +13,330 @@ 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
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
|
package gplx.xowa.mediawiki;
|
||||||
import org.junit.*; import gplx.core.tests.*;
|
|
||||||
public class XophpArray__tst { // REF:https://www.php.net/manual/en/function.array-merge.php
|
import gplx.Bool_;
|
||||||
private final XophpArray__fxt fxt = new XophpArray__fxt();
|
import gplx.core.tests.Gftest;
|
||||||
@Test public void array_merge__basic() {
|
import org.junit.Test;
|
||||||
XophpArray ary1 = fxt.Make().Add("key1", "val1").Add("a");
|
|
||||||
XophpArray ary2 = fxt.Make().Add("key2", "val2").Add("b");
|
public class XophpArray__tst {
|
||||||
fxt.Test__eq
|
private final XophpArray__fxt fxt = new XophpArray__fxt();
|
||||||
( fxt.Make().Add("key1", "val1").Add("a").Add("key2", "val2").Add("b")
|
// REF.PHP:https://www.php.net/manual/en/function.array-merge.php
|
||||||
, XophpArray_.array_merge(ary1, ary2));
|
@Test public void array_merge__basic() {
|
||||||
}
|
XophpArray ary1 = fxt.Make().Add("key1", "val1").Add("a");
|
||||||
@Test public void array_merge__same_key() {
|
XophpArray ary2 = fxt.Make().Add("key2", "val2").Add("b");
|
||||||
XophpArray ary1 = fxt.Make().Add("key", "val1");
|
fxt.Test__eq
|
||||||
XophpArray ary2 = fxt.Make().Add("key", "val2");
|
( fxt.Make().Add("key1", "val1").Add("a").Add("key2", "val2").Add("b")
|
||||||
fxt.Test__eq
|
, XophpArray_.array_merge(ary1, ary2));
|
||||||
( fxt.Make().Add("key", "val2")
|
}
|
||||||
, XophpArray_.array_merge(ary1, ary2));
|
@Test public void array_merge__same_key() {
|
||||||
}
|
XophpArray ary1 = fxt.Make().Add("key", "val1");
|
||||||
@Test public void array_merge__same_idx() {
|
XophpArray ary2 = fxt.Make().Add("key", "val2");
|
||||||
XophpArray ary1 = fxt.Make().Add(0, "a");
|
fxt.Test__eq
|
||||||
XophpArray ary2 = fxt.Make().Add(0, "b");
|
( fxt.Make().Add("key", "val2")
|
||||||
fxt.Test__eq
|
, XophpArray_.array_merge(ary1, ary2));
|
||||||
( fxt.Make().Add(0, "a").Add(1, "b")
|
}
|
||||||
, XophpArray_.array_merge(ary1, ary2));
|
@Test public void array_merge__same_idx() {
|
||||||
}
|
XophpArray ary1 = fxt.Make().Add(0, "a");
|
||||||
@Test public void array_merge__renumber() {
|
XophpArray ary2 = fxt.Make().Add(0, "b");
|
||||||
XophpArray ary1 = fxt.Make().Add(3, "a");
|
fxt.Test__eq
|
||||||
XophpArray ary2 = fxt.Make().Add(2, "b");
|
( fxt.Make().Add(0, "a").Add(1, "b")
|
||||||
fxt.Test__eq
|
, XophpArray_.array_merge(ary1, ary2));
|
||||||
( fxt.Make().Add(0, "a").Add(1, "b")
|
}
|
||||||
, XophpArray_.array_merge(ary1, ary2));
|
@Test public void array_merge__renumber() {
|
||||||
}
|
XophpArray ary1 = fxt.Make().Add(3, "a");
|
||||||
@Test public void array_merge__example_1() {
|
XophpArray ary2 = fxt.Make().Add(2, "b");
|
||||||
XophpArray ary1 = fxt.Make().Add("color", "red").Add_many(2, 4);
|
fxt.Test__eq
|
||||||
XophpArray ary2 = fxt.Make().Add_many("a", "b").Add("color", "green").Add("shape", "trapezoid").Add(4);
|
( fxt.Make().Add(0, "a").Add(1, "b")
|
||||||
fxt.Test__eq
|
, XophpArray_.array_merge(ary1, ary2));
|
||||||
( fxt.Make().Add("color", "green").Add_many(2, 4, "a", "b").Add("shape", "trapezoid").Add(4)
|
}
|
||||||
, XophpArray_.array_merge(ary1, ary2));
|
@Test public void array_merge__example_1() {
|
||||||
}
|
XophpArray ary1 = fxt.Make().Add("color", "red").Add_many(2, 4);
|
||||||
@Test public void array_merge__example_2() {
|
XophpArray ary2 = fxt.Make().Add_many("a", "b").Add("color", "green").Add("shape", "trapezoid").Add(4);
|
||||||
XophpArray ary1 = fxt.Make();
|
fxt.Test__eq
|
||||||
XophpArray ary2 = fxt.Make().Add(1, "data");
|
( fxt.Make().Add("color", "green").Add_many(2, 4, "a", "b").Add("shape", "trapezoid").Add(4)
|
||||||
fxt.Test__eq
|
, XophpArray_.array_merge(ary1, ary2));
|
||||||
( fxt.Make().Add(0, "data")
|
}
|
||||||
, XophpArray_.array_merge(ary1, ary2));
|
@Test public void array_merge__example_2() {
|
||||||
}
|
XophpArray ary1 = fxt.Make();
|
||||||
@Test public void array_add() {
|
XophpArray ary2 = fxt.Make().Add(1, "data");
|
||||||
XophpArray ary1 = fxt.Make().Add(0, "zero_a").Add(2, "two_a").Add(3, "three_a");
|
fxt.Test__eq
|
||||||
XophpArray ary2 = fxt.Make().Add(1, "one_b").Add(3, "three_b").Add(4, "four_b");
|
( fxt.Make().Add(0, "data")
|
||||||
fxt.Test__eq
|
, XophpArray_.array_merge(ary1, ary2));
|
||||||
( fxt.Make().Add(0, "zero_a").Add(2, "two_a").Add(3, "three_a").Add(1, "one_b").Add(4, "four_b")
|
}
|
||||||
, XophpArray_.array_add(ary1, ary2));
|
@Test public void array_add() {
|
||||||
}
|
XophpArray ary1 = fxt.Make().Add(0, "zero_a").Add(2, "two_a").Add(3, "three_a");
|
||||||
@Test public void array_splice__bgn_is_positive() {
|
XophpArray ary2 = fxt.Make().Add(1, "one_b").Add(3, "three_b").Add(4, "four_b");
|
||||||
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
fxt.Test__eq
|
||||||
XophpArray del = XophpArray_.array_splice(src, 1);
|
( fxt.Make().Add(0, "zero_a").Add(2, "two_a").Add(3, "three_a").Add(1, "one_b").Add(4, "four_b")
|
||||||
fxt.Test__eq
|
, XophpArray_.array_add(ary1, ary2));
|
||||||
( fxt.Make().Add_many("a")
|
}
|
||||||
, src
|
@Test public void array_splice__bgn_is_positive() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 1);
|
||||||
( fxt.Make().Add_many("b", "c", "d")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("a")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__bgn_is_positive_large() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
( fxt.Make().Add_many("b", "c", "d")
|
||||||
XophpArray del = XophpArray_.array_splice(src, 99);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("a", "b", "c", "d")
|
}
|
||||||
, src
|
@Test public void array_splice__bgn_is_positive_large() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 99);
|
||||||
( fxt.Make().Add_many()
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("a", "b", "c", "d")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__bgn_is_negative() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
( fxt.Make().Add_many()
|
||||||
XophpArray del = XophpArray_.array_splice(src, -3);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("a")
|
}
|
||||||
, src
|
@Test public void array_splice__bgn_is_negative() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, -3);
|
||||||
( fxt.Make().Add_many("b", "c", "d")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("a")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__bgn_is_negative_large() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
( fxt.Make().Add_many("b", "c", "d")
|
||||||
XophpArray del = XophpArray_.array_splice(src, -99);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make()
|
}
|
||||||
, src
|
@Test public void array_splice__bgn_is_negative_large() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, -99);
|
||||||
( fxt.Make().Add_many("a", "b", "c", "d")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make()
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__len_is_positive() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
( fxt.Make().Add_many("a", "b", "c", "d")
|
||||||
XophpArray del = XophpArray_.array_splice(src, 1, 2);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("a", "d")
|
}
|
||||||
, src
|
@Test public void array_splice__len_is_positive() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 1, 2);
|
||||||
( fxt.Make().Add_many("b", "c")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("a", "d")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__len_is_positive_large() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
( fxt.Make().Add_many("b", "c")
|
||||||
XophpArray del = XophpArray_.array_splice(src, 1, 99);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("a")
|
}
|
||||||
, src
|
@Test public void array_splice__len_is_positive_large() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 1, 99);
|
||||||
( fxt.Make().Add_many("b", "c", "d")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("a")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__len_is_negative() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
( fxt.Make().Add_many("b", "c", "d")
|
||||||
XophpArray del = XophpArray_.array_splice(src, 1, -2);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("a", "c", "d")
|
}
|
||||||
, src
|
@Test public void array_splice__len_is_negative() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 1, -2);
|
||||||
( fxt.Make().Add_many("b")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("a", "c", "d")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__len_is_negative_large() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
( fxt.Make().Add_many("b")
|
||||||
XophpArray del = XophpArray_.array_splice(src, 1, -99);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("a", "b", "c", "d")
|
}
|
||||||
, src
|
@Test public void array_splice__len_is_negative_large() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("a", "b", "c", "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 1, -99);
|
||||||
( fxt.Make()
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("a", "b", "c", "d")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__repl() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add(0, "a").Add(1, "b").Add(2, "c").Add(3, "d");
|
( fxt.Make()
|
||||||
XophpArray del = XophpArray_.array_splice(src, 1, 2, fxt.Make().Add(0, "x"));
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add(0, "a").Add(1, "x").Add(2, "d")
|
}
|
||||||
, src
|
@Test public void array_splice__repl() {
|
||||||
);
|
XophpArray src = fxt.Make().Add(0, "a").Add(1, "b").Add(2, "c").Add(3, "d");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 1, 2, fxt.Make().Add(0, "x"));
|
||||||
( fxt.Make().Add(0, "b").Add(1, "c")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add(0, "a").Add(1, "x").Add(2, "d")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__example_1a() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow");
|
( fxt.Make().Add(0, "b").Add(1, "c")
|
||||||
XophpArray del = XophpArray_.array_splice(src, 2);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("red", "green")
|
}
|
||||||
, src
|
@Test public void array_splice__example_1a() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 2);
|
||||||
( fxt.Make().Add_many("blue", "yellow")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("red", "green")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__example_1b() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow");
|
( fxt.Make().Add_many("blue", "yellow")
|
||||||
XophpArray del = XophpArray_.array_splice(src, 1, -1);
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("red", "yellow")
|
}
|
||||||
, src
|
@Test public void array_splice__example_1b() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 1, -1);
|
||||||
( fxt.Make().Add_many("green", "blue")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("red", "yellow")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__example_1c() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow");
|
( fxt.Make().Add_many("green", "blue")
|
||||||
XophpArray del = XophpArray_.array_splice(src, 1, 4, XophpArray.New("orange"));
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("red", "orange")
|
}
|
||||||
, src
|
@Test public void array_splice__example_1c() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, 1, 4, XophpArray.New("orange"));
|
||||||
( fxt.Make().Add_many("green", "blue", "yellow")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("red", "orange")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void array_splice__example_1d() {
|
fxt.Test__eq
|
||||||
XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow");
|
( fxt.Make().Add_many("green", "blue", "yellow")
|
||||||
XophpArray del = XophpArray_.array_splice(src, -1, 1, XophpArray.New("black", "maroon"));
|
, del
|
||||||
fxt.Test__eq
|
);
|
||||||
( fxt.Make().Add_many("red", "green", "blue", "black", "maroon")
|
}
|
||||||
, src
|
@Test public void array_splice__example_1d() {
|
||||||
);
|
XophpArray src = fxt.Make().Add_many("red", "green", "blue", "yellow");
|
||||||
fxt.Test__eq
|
XophpArray del = XophpArray_.array_splice(src, -1, 1, XophpArray.New("black", "maroon"));
|
||||||
( fxt.Make().Add_many("yellow")
|
fxt.Test__eq
|
||||||
, del
|
( fxt.Make().Add_many("red", "green", "blue", "black", "maroon")
|
||||||
);
|
, src
|
||||||
}
|
);
|
||||||
@Test public void values() {
|
fxt.Test__eq
|
||||||
XophpArray orig = fxt.Make().Add("size", "XL").Add("color", "gold");
|
( fxt.Make().Add_many("yellow")
|
||||||
fxt.Test__eq
|
, del
|
||||||
( fxt.Make().Add(0, "XL").Add(1, "gold")
|
);
|
||||||
, orig.values()
|
}
|
||||||
);
|
@Test public void values() {
|
||||||
}
|
XophpArray orig = fxt.Make().Add("size", "XL").Add("color", "gold");
|
||||||
@Test public void array_map() {
|
fxt.Test__eq
|
||||||
XophpArray orig = fxt.Make().Add_many("a", "b", "c");
|
( fxt.Make().Add(0, "XL").Add(1, "gold")
|
||||||
fxt.Test__eq
|
, orig.values()
|
||||||
( fxt.Make().Add_many("A", "B", "C")
|
);
|
||||||
, XophpArray_.array_map(XophpString_.Callback_owner, "strtoupper", orig)
|
}
|
||||||
);
|
@Test public void array_map() {
|
||||||
}
|
XophpArray orig = fxt.Make().Add_many("a", "b", "c");
|
||||||
@Test public void array_flip__basic() {
|
fxt.Test__eq
|
||||||
XophpArray orig = fxt.Make().Add_many("oranges", "apples", "pears");
|
( fxt.Make().Add_many("A", "B", "C")
|
||||||
fxt.Test__eq
|
, XophpArray_.array_map(XophpString_.Callback_owner, "strtoupper", orig)
|
||||||
( fxt.Make().Add("oranges", 0).Add("apples", 1).Add("pears", 2)
|
);
|
||||||
, XophpArray_.array_flip(orig)
|
}
|
||||||
);
|
@Test public void array_flip__basic() {
|
||||||
}
|
XophpArray orig = fxt.Make().Add_many("oranges", "apples", "pears");
|
||||||
@Test public void array_flip__collision() {
|
fxt.Test__eq
|
||||||
XophpArray orig = fxt.Make().Add("a", 1).Add("b", 1).Add("c", 2);
|
( fxt.Make().Add("oranges", 0).Add("apples", 1).Add("pears", 2)
|
||||||
fxt.Test__eq
|
, XophpArray_.array_flip(orig)
|
||||||
( fxt.Make().Add("1", "b").Add("2", "c")
|
);
|
||||||
, XophpArray_.array_flip(orig)
|
}
|
||||||
);
|
@Test public void array_flip__collision() {
|
||||||
}
|
XophpArray orig = fxt.Make().Add("a", 1).Add("b", 1).Add("c", 2);
|
||||||
@Test public void implode() {
|
fxt.Test__eq
|
||||||
XophpArray orig = fxt.Make().Add_many("a", "b", "c");
|
( fxt.Make().Add("1", "b").Add("2", "c")
|
||||||
Gftest.Eq__str
|
, XophpArray_.array_flip(orig)
|
||||||
( "a b c"
|
);
|
||||||
, XophpArray_.implode(" ", orig)
|
}
|
||||||
);
|
@Test public void implode() {
|
||||||
}
|
XophpArray orig = fxt.Make().Add_many("a", "b", "c");
|
||||||
@Test public void in_array() {
|
Gftest.Eq__str
|
||||||
// PHP samples
|
( "a b c"
|
||||||
XophpArray array;
|
, XophpArray_.implode(" ", orig)
|
||||||
// Example #1
|
);
|
||||||
array = XophpArray.New("Mac", "NT", "Irix", "Linux");
|
}
|
||||||
Gftest.Eq__bool(Bool_.Y, XophpArray_.in_array("Irix", array));
|
@Test public void in_array() {
|
||||||
Gftest.Eq__bool(Bool_.N, XophpArray_.in_array("mac" , array));
|
// PHP samples
|
||||||
|
XophpArray array;
|
||||||
// Example #2
|
// Example #1
|
||||||
array = XophpArray.New(12.4d, 1.13d);
|
array = XophpArray.New("Mac", "NT", "Irix", "Linux");
|
||||||
Gftest.Eq__bool(Bool_.N, XophpArray_.in_array("12.4", array, true));
|
Gftest.Eq__bool(Bool_.Y, XophpArray_.in_array("Irix", array));
|
||||||
Gftest.Eq__bool(Bool_.Y, XophpArray_.in_array( 1.13d, array, true));
|
Gftest.Eq__bool(Bool_.N, XophpArray_.in_array("mac" , array));
|
||||||
|
|
||||||
// Example #3
|
// Example #2
|
||||||
array = XophpArray.New(XophpArray.New('p', 'h'), XophpArray.New('p', 'r'), 'o');
|
array = XophpArray.New(12.4d, 1.13d);
|
||||||
Gftest.Eq__bool(Bool_.Y, XophpArray_.in_array(XophpArray.New('p', 'h'), array));
|
Gftest.Eq__bool(Bool_.N, XophpArray_.in_array("12.4", array, true));
|
||||||
Gftest.Eq__bool(Bool_.N, XophpArray_.in_array(XophpArray.New('f', 'i'), array));
|
Gftest.Eq__bool(Bool_.Y, XophpArray_.in_array( 1.13d, array, true));
|
||||||
Gftest.Eq__bool(Bool_.Y, XophpArray_.in_array('o', array));
|
|
||||||
}
|
// Example #3
|
||||||
}
|
array = XophpArray.New(XophpArray.New('p', 'h'), XophpArray.New('p', 'r'), 'o');
|
||||||
class XophpArray__fxt {
|
Gftest.Eq__bool(Bool_.Y, XophpArray_.in_array(XophpArray.New('p', 'h'), array));
|
||||||
public XophpArray Make() {return new XophpArray();}
|
Gftest.Eq__bool(Bool_.N, XophpArray_.in_array(XophpArray.New('f', 'i'), array));
|
||||||
public void Test__eq(XophpArray expd, XophpArray actl) {
|
Gftest.Eq__bool(Bool_.Y, XophpArray_.in_array('o', array));
|
||||||
Gftest.Eq__str(expd.To_str(), actl.To_str());
|
}
|
||||||
}
|
@Test public void array_shift() {
|
||||||
}
|
XophpArray array;
|
||||||
|
String shifted;
|
||||||
|
|
||||||
|
// key is int
|
||||||
|
array = XophpArray.New("a", "b");
|
||||||
|
shifted = (String)XophpArray_.array_shift(array);
|
||||||
|
|
||||||
|
Gftest.Eq__str("a", shifted);
|
||||||
|
fxt.Test__eq
|
||||||
|
( XophpArray.New().Add(0, "b")
|
||||||
|
, array
|
||||||
|
);
|
||||||
|
|
||||||
|
// key is str and int
|
||||||
|
array = XophpArray.New().Add("a", "a").Add(2, "b").Add(5, "c");
|
||||||
|
shifted = (String)XophpArray_.array_shift(array);
|
||||||
|
|
||||||
|
Gftest.Eq__str("a", shifted);
|
||||||
|
fxt.Test__eq
|
||||||
|
( XophpArray.New().Add(0, "b").Add(1, "c")
|
||||||
|
, array
|
||||||
|
);
|
||||||
|
|
||||||
|
// empty
|
||||||
|
array = XophpArray.New();
|
||||||
|
shifted = (String)XophpArray_.array_shift(array);
|
||||||
|
|
||||||
|
Gftest.Eq__bool_y(shifted == null);
|
||||||
|
fxt.Test__eq
|
||||||
|
( XophpArray.New()
|
||||||
|
, array
|
||||||
|
);
|
||||||
|
|
||||||
|
// null
|
||||||
|
array = null;
|
||||||
|
shifted = (String)XophpArray_.array_shift(array);
|
||||||
|
|
||||||
|
Gftest.Eq__bool_y(shifted == null);
|
||||||
|
Gftest.Eq__bool_y(array == null);
|
||||||
|
|
||||||
|
// PHP samples
|
||||||
|
// Example #1
|
||||||
|
array = XophpArray.New("orange", "banana", "apple", "strawberry");
|
||||||
|
shifted = (String)XophpArray_.array_shift(array);
|
||||||
|
|
||||||
|
Gftest.Eq__str("orange", shifted);
|
||||||
|
fxt.Test__eq
|
||||||
|
( XophpArray.New().Add(0, "banana").Add(1, "apple").Add(2, "strawberry")
|
||||||
|
, array
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class XophpArray__fxt {
|
||||||
|
public XophpArray Make() {return new XophpArray();}
|
||||||
|
public void Test__eq(XophpArray expd, XophpArray actl) {
|
||||||
|
Gftest.Eq__str(expd.To_str(), actl.To_str());
|
||||||
|
}
|
||||||
|
}
|
@ -13,172 +13,172 @@ 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
|
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||||
*/
|
*/
|
||||||
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
|
package gplx.xowa.mediawiki; import gplx.*; import gplx.xowa.*;
|
||||||
import org.junit.*; import gplx.core.tests.*;
|
import org.junit.*; import gplx.core.tests.*;
|
||||||
public class XophpArray_tst { // REF: http://php.net/manual/en/language.types.array.php
|
public class XophpArray_tst { // REF: http://php.net/manual/en/language.types.array.php
|
||||||
private final XophpArray_fxt fxt = new XophpArray_fxt();
|
private final XophpArray_fxt fxt = new XophpArray_fxt();
|
||||||
@Test public void array__kvs() {
|
@Test public void array__kvs() {
|
||||||
// $array = array("foo" => "bar", "bar" => "foo",);
|
// $array = array("foo" => "bar", "bar" => "foo",);
|
||||||
fxt.Test__array
|
fxt.Test__array
|
||||||
( XophpArray.New()
|
( XophpArray.New()
|
||||||
. Add("foo", "bar")
|
. Add("foo", "bar")
|
||||||
. Add("bar", "foo")
|
. Add("bar", "foo")
|
||||||
, XophpArrayItm.New_str("foo", "bar")
|
, XophpArrayItm.New_str("foo", "bar")
|
||||||
, XophpArrayItm.New_str("bar", "foo")
|
, XophpArrayItm.New_str("bar", "foo")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@Test public void array__casting() {
|
@Test public void array__casting() {
|
||||||
// $array = array(1 => "a", "1" => "b", 1.5 => "c", true => "d",);
|
// $array = array(1 => "a", "1" => "b", 1.5 => "c", true => "d",);
|
||||||
fxt.Test__array
|
fxt.Test__array
|
||||||
( XophpArray.New()
|
( XophpArray.New()
|
||||||
. Add(1 , "a")
|
. Add(1 , "a")
|
||||||
. Add("1" , "b")
|
. Add("1" , "b")
|
||||||
. Add(1.5 , "c")
|
. Add(1.5 , "c")
|
||||||
. Add(true, "d")
|
. Add(true, "d")
|
||||||
, XophpArrayItm.New_int(1, "d"));
|
, XophpArrayItm.New_int(1, "d"));
|
||||||
}
|
}
|
||||||
@Test public void array__mixed() {
|
@Test public void array__mixed() {
|
||||||
// $array = array("foo" => "bar", "bar" => "foo", 100 => -100, -100 => 100);
|
// $array = array("foo" => "bar", "bar" => "foo", 100 => -100, -100 => 100);
|
||||||
fxt.Test__array
|
fxt.Test__array
|
||||||
( XophpArray.New()
|
( XophpArray.New()
|
||||||
. Add("foo", "bar")
|
. Add("foo", "bar")
|
||||||
. Add("bar", "foo")
|
. Add("bar", "foo")
|
||||||
. Add(100, -100)
|
. Add(100, -100)
|
||||||
. Add(-100, 100)
|
. Add(-100, 100)
|
||||||
, XophpArrayItm.New_str("foo", "bar")
|
, XophpArrayItm.New_str("foo", "bar")
|
||||||
, XophpArrayItm.New_str("bar", "foo")
|
, XophpArrayItm.New_str("bar", "foo")
|
||||||
, XophpArrayItm.New_int(100, -100)
|
, XophpArrayItm.New_int(100, -100)
|
||||||
, XophpArrayItm.New_int(-100, 100)
|
, XophpArrayItm.New_int(-100, 100)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@Test public void array__objs() {
|
@Test public void array__objs() {
|
||||||
// $array = array("foo", "bar", "hello", "world");
|
// $array = array("foo", "bar", "hello", "world");
|
||||||
fxt.Test__array
|
fxt.Test__array
|
||||||
( XophpArray.New()
|
( XophpArray.New()
|
||||||
. Add("foo")
|
. Add("foo")
|
||||||
. Add("bar")
|
. Add("bar")
|
||||||
. Add("hello")
|
. Add("hello")
|
||||||
. Add("world")
|
. Add("world")
|
||||||
, XophpArrayItm.New_int(0, "foo")
|
, XophpArrayItm.New_int(0, "foo")
|
||||||
, XophpArrayItm.New_int(1, "bar")
|
, XophpArrayItm.New_int(1, "bar")
|
||||||
, XophpArrayItm.New_int(2, "hello")
|
, XophpArrayItm.New_int(2, "hello")
|
||||||
, XophpArrayItm.New_int(3, "world")
|
, XophpArrayItm.New_int(3, "world")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@Test public void array__unkeyed() {
|
@Test public void array__unkeyed() {
|
||||||
// $array = array("a", "b", 6 => "c", "d");
|
// $array = array("a", "b", 6 => "c", "d");
|
||||||
fxt.Test__array
|
fxt.Test__array
|
||||||
( XophpArray.New()
|
( XophpArray.New()
|
||||||
. Add("a")
|
. Add("a")
|
||||||
. Add("b")
|
. Add("b")
|
||||||
. Add(6, "c")
|
. Add(6, "c")
|
||||||
. Add("d")
|
. Add("d")
|
||||||
, XophpArrayItm.New_int(0, "a")
|
, XophpArrayItm.New_int(0, "a")
|
||||||
, XophpArrayItm.New_int(1, "b")
|
, XophpArrayItm.New_int(1, "b")
|
||||||
, XophpArrayItm.New_int(6, "c")
|
, XophpArrayItm.New_int(6, "c")
|
||||||
, XophpArrayItm.New_int(7, "d")
|
, XophpArrayItm.New_int(7, "d")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@Test public void array__multidimensional() {
|
@Test public void array__multidimensional() {
|
||||||
/*
|
/*
|
||||||
$array = array(
|
$array = array(
|
||||||
"foo" => "bar",
|
"foo" => "bar",
|
||||||
42 => 24,
|
42 => 24,
|
||||||
"multi" => array(
|
"multi" => array(
|
||||||
"dimensional" => array(
|
"dimensional" => array(
|
||||||
"array" => "foo"
|
"array" => "foo"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
fxt.Test__array
|
fxt.Test__array
|
||||||
( XophpArray.New()
|
( XophpArray.New()
|
||||||
. Add("foo" , "bar")
|
. Add("foo" , "bar")
|
||||||
. Add(42 , 24)
|
. Add(42 , 24)
|
||||||
. Add("multi" , XophpArray.New()
|
. Add("multi" , XophpArray.New()
|
||||||
. Add("dimensional", XophpArray.New()
|
. Add("dimensional", XophpArray.New()
|
||||||
. Add("array", "foo")
|
. Add("array", "foo")
|
||||||
))
|
))
|
||||||
, XophpArrayItm.New_str("foo", "bar")
|
, XophpArrayItm.New_str("foo", "bar")
|
||||||
, XophpArrayItm.New_int(42, "24")
|
, XophpArrayItm.New_int(42, "24")
|
||||||
, XophpArrayItm.New_str("multi", XophpArray.New()
|
, XophpArrayItm.New_str("multi", XophpArray.New()
|
||||||
. Add("dimensional", XophpArray.New()
|
. Add("dimensional", XophpArray.New()
|
||||||
. Add("array", "foo")
|
. Add("array", "foo")
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@Test public void array__unset() {
|
@Test public void array__unset() {
|
||||||
XophpArray ary = XophpArray.New();
|
XophpArray ary = XophpArray.New();
|
||||||
ary.Add(0, "a").Add(1, "b");
|
ary.Add(0, "a").Add(1, "b");
|
||||||
|
|
||||||
// delete all
|
// delete all
|
||||||
ary.unset(0);
|
ary.unset(0);
|
||||||
ary.unset(1);
|
ary.unset(1);
|
||||||
fxt.Test__array(ary);
|
fxt.Test__array(ary);
|
||||||
|
|
||||||
// add new and assert idx is 2
|
// add new and assert idx is 2
|
||||||
ary.Add("c");
|
ary.Add("c");
|
||||||
fxt.Test__array(ary, XophpArrayItm.New_int(2, "c"));
|
fxt.Test__array(ary, XophpArrayItm.New_int(2, "c"));
|
||||||
}
|
}
|
||||||
@Test public void Pop() {
|
@Test public void Pop() {
|
||||||
XophpArray ary = XophpArray.New();
|
XophpArray ary = XophpArray.New();
|
||||||
ary.Add(0, "a").Add(1, "b").Add(2, "c");
|
ary.Add(0, "a").Add(1, "b").Add(2, "c");
|
||||||
|
|
||||||
// pop all
|
// pop all
|
||||||
fxt.Test__Pop(ary, "c");
|
fxt.Test__Pop(ary, "c");
|
||||||
fxt.Test__Pop(ary, "b");
|
fxt.Test__Pop(ary, "b");
|
||||||
fxt.Test__Pop(ary, "a");
|
fxt.Test__Pop(ary, "a");
|
||||||
fxt.Test__Count(ary, 0);
|
fxt.Test__Count(ary, 0);
|
||||||
fxt.Test__Pop(ary, null);
|
fxt.Test__Pop(ary, null);
|
||||||
}
|
}
|
||||||
@Test public void Itm_str_concat_end() {
|
@Test public void Itm_str_concat_end() {
|
||||||
XophpArray ary = XophpArray.New();
|
XophpArray ary = XophpArray.New();
|
||||||
ary.Add(0, "a").Add(1, "b").Add(2, "c");
|
ary.Add(0, "a").Add(1, "b").Add(2, "c");
|
||||||
|
|
||||||
// pop all
|
// pop all
|
||||||
fxt.Test__Itm_str_concat_end(ary, "a0", 0, "0");
|
fxt.Test__Itm_str_concat_end(ary, "a0", 0, "0");
|
||||||
fxt.Test__Itm_str_concat_end(ary, "b1", 1, "1");
|
fxt.Test__Itm_str_concat_end(ary, "b1", 1, "1");
|
||||||
fxt.Test__Itm_str_concat_end(ary, "c2", 2, "2");
|
fxt.Test__Itm_str_concat_end(ary, "c2", 2, "2");
|
||||||
}
|
}
|
||||||
@Test public void Clone() {
|
@Test public void Clone() {
|
||||||
XophpArray ary = XophpArray.New();
|
XophpArray ary = XophpArray.New();
|
||||||
ary.Add(0, "a").Add(1, "b").Add(2, "c");
|
ary.Add(0, "a").Add(1, "b").Add(2, "c");
|
||||||
|
|
||||||
fxt.Test__Eq(ary, ary.Clone());
|
fxt.Test__Eq(ary, ary.Clone());
|
||||||
}
|
}
|
||||||
@Test public void Get_by() {
|
@Test public void Get_by() {
|
||||||
XophpArray ary = XophpArray.New();
|
XophpArray ary = XophpArray.New();
|
||||||
ary.Add("0", "a").Add("1", "b").Add("2", "c");
|
ary.Add("0", "a").Add("1", "b").Add("2", "c");
|
||||||
|
|
||||||
fxt.Test__Get_by(ary, "0", "a");
|
fxt.Test__Get_by(ary, "0", "a");
|
||||||
fxt.Test__Get_by(ary, "missing", null);
|
fxt.Test__Get_by(ary, "missing", null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class XophpArray_fxt {
|
class XophpArray_fxt {
|
||||||
public void Test__Count(XophpArray ary, int expd) {
|
public void Test__Count(XophpArray ary, int expd) {
|
||||||
Gftest.Eq__int(expd, ary.count());
|
Gftest.Eq__int(expd, ary.count());
|
||||||
}
|
}
|
||||||
public void Test__array(XophpArray ary, XophpArrayItm... expd) {
|
public void Test__array(XophpArray ary, XophpArrayItm... expd) {
|
||||||
XophpArrayItm[] actl = ary.To_ary();
|
XophpArrayItm[] actl = ary.To_ary();
|
||||||
Gftest.Eq__ary(expd, actl);
|
Gftest.Eq__ary(expd, actl);
|
||||||
}
|
}
|
||||||
public void Test__unset(XophpArray ary, int idx, XophpArrayItm... expd) {
|
public void Test__unset(XophpArray ary, int idx, XophpArrayItm... expd) {
|
||||||
XophpArrayItm[] actl = ary.To_ary();
|
XophpArrayItm[] actl = ary.To_ary();
|
||||||
Gftest.Eq__ary(expd, actl);
|
Gftest.Eq__ary(expd, actl);
|
||||||
}
|
}
|
||||||
public void Test__Pop(XophpArray ary, String expd) {
|
public void Test__Pop(XophpArray ary, String expd) {
|
||||||
String actl = (String)ary.pop();
|
String actl = (String)ary.pop();
|
||||||
Gftest.Eq__str(expd, actl);
|
Gftest.Eq__str(expd, actl);
|
||||||
}
|
}
|
||||||
public void Test__Itm_str_concat_end(XophpArray ary, String expd, int idx, String v) {
|
public void Test__Itm_str_concat_end(XophpArray ary, String expd, int idx, String v) {
|
||||||
ary.Itm_str_concat_end(idx, v);
|
ary.Itm_str_concat_end(idx, v);
|
||||||
String actl = ary.Get_at_str(idx);
|
String actl = ary.Get_at_str(idx);
|
||||||
Gftest.Eq__str(expd, actl);
|
Gftest.Eq__str(expd, actl);
|
||||||
}
|
}
|
||||||
public void Test__Eq(XophpArray lhs, XophpArray rhs) {
|
public void Test__Eq(XophpArray lhs, XophpArray rhs) {
|
||||||
Gftest.Eq__ary(lhs.To_ary(), rhs.To_ary());
|
Gftest.Eq__ary(lhs.To_ary(), rhs.To_ary());
|
||||||
}
|
}
|
||||||
public void Test__Get_by(XophpArray ary, String key, Object expd) {
|
public void Test__Get_by(XophpArray ary, String key, Object expd) {
|
||||||
Gftest.Eq__obj_or_null(expd, ary.Get_by(key));
|
Gftest.Eq__obj_or_null(expd, ary.Get_by(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user