mediawiki-extensions-AbuseF.../tests/parserTests/mwexamples-arrays.t
Daimona Eaytoy 39fc7c12af Restore unit tests for CachingParser and fix it
Added cachingParser back to *all* the parser tests, fixed a couple of
differences with the normal parser, and added a couple of tests so that
any cachingParser-related file has 100% coverage. Also move the remaining
get_matches tests inside parserTests, and specify the parser used in case of failure.
This also adds a new base class for parser-related tests with a couple
of util methods.

Bug: T201193
Change-Id: I980aec3481a52ecc35f1811a366014a5581a7cdb
2019-05-25 10:55:24 +02:00

19 lines
448 B
Perl

/* Examples from [[mw:Extension:AbuseFilter/Rules format#Arrays]] */
my_array := [ 5, 6, 7, 10];
my_array[0] == 5 &
length(my_array) == 4 &
int( my_array ) === 4 &
float( my_array ) === 4.0 &
string(my_array) == "5\n6\n7\n10\n" &
5 in my_array == true &
'5' in my_array == true &
'5\n6' in my_array == true &
1 in my_array == true & (
my_array[] := 57;
my_array === [ 5, 6, 7, 10, 57 ]
) & (
my_array[2] := 42;
my_array === [ 5, 6, 42, 10, 57 ]
)