From 91e194556c52d2f354344f930419eef2dd6267f0 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 4 Sep 2013 05:51:59 +0200 Subject: Update to MediaWiki 1.21.2 --- extensions/ParserFunctions/.gitreview | 5 ++ .../ParserFunctions/ParserFunctions.i18n.magic.php | 4 +- .../ParserFunctions/tests/ExpressionTest.php | 76 ++++++++++++++++++++++ 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 extensions/ParserFunctions/.gitreview create mode 100644 extensions/ParserFunctions/tests/ExpressionTest.php (limited to 'extensions/ParserFunctions') diff --git a/extensions/ParserFunctions/.gitreview b/extensions/ParserFunctions/.gitreview new file mode 100644 index 00000000..decb9867 --- /dev/null +++ b/extensions/ParserFunctions/.gitreview @@ -0,0 +1,5 @@ +[gerrit] +host=gerrit.wikimedia.org +port=29418 +project=mediawiki/extensions/ParserFunctions.git +defaultbranch=master diff --git a/extensions/ParserFunctions/ParserFunctions.i18n.magic.php b/extensions/ParserFunctions/ParserFunctions.i18n.magic.php index 1a37cf9e..4fdb83eb 100644 --- a/extensions/ParserFunctions/ParserFunctions.i18n.magic.php +++ b/extensions/ParserFunctions/ParserFunctions.i18n.magic.php @@ -96,8 +96,8 @@ $magicWords['br'] = array( /** Chechen (нохчийн) */ $magicWords['ce'] = array( - 'time' => array( 0, 'хан' ), - 'replace' => array( 0, 'хийцарна', 'замена' ), + 'time' => array( 0, 'хан', 'time' ), + 'replace' => array( 0, 'хийцарна', 'замена', 'replace' ), ); /** Czech (česky) */ diff --git a/extensions/ParserFunctions/tests/ExpressionTest.php b/extensions/ParserFunctions/tests/ExpressionTest.php new file mode 100644 index 00000000..169a9cb4 --- /dev/null +++ b/extensions/ParserFunctions/tests/ExpressionTest.php @@ -0,0 +1,76 @@ +parser = new ExprParser(); + } + + /** + * @dataProvider provideExpressions + */ + function testExpression( $input, $expected ) { + $this->assertEquals( + $expected, + $this->parser->doExpression( $input ) + ); + } + + function provideExpressions() { + return array( + array( '1 or 0', '1' ), + array( 'not (1 and 0)', '1' ), + array( 'not 0', '1' ), + array( '4 < 5', '1' ), + array( '-5 < 2', '1' ), + array( '-2 <= -2', '1' ), + array( '4 > 3', '1' ), + array( '4 > -3', '1' ), + array( '5 >= 2', '1' ), + array( '2 >= 2', '1' ), + array( '1 != 2', '1' ), + array( '-4 * -4 = 4 * 4', '1' ), + array( 'not (1 != 1)', '1' ), + array( '1 + 1', '2' ), + array( '-1 + 1', '0' ), + array( '+1 + 1', '2' ), + array( '4 * 4', '16' ), + array( '(1/3) * 3', '1' ), + array( '3 / 1.5', '2' ), + array( '3 / 0.2', '15' ), + array( '3 / ( 2.0 * 0.1 )', '15' ), + array( '3 / ( 2.0 / 10 )', '15' ), + array( '3 / (- 0.2 )', '-15' ), + array( '3 / abs( 0.2 )', '15' ), + array( '3 mod 2', '1' ), + array( '1e4', '10000' ), + array( '1e-2', '0.01' ), + array( '4.0 round 0', '4' ), + array( 'ceil 4', '4' ), + array( 'floor 4', '4' ), + array( '4.5 round 0', '5' ), + array( '4.2 round 0', '4' ), + array( '-4.2 round 0', '-4' ), + array( '-4.5 round 0', '-5' ), + array( '-2.0 round 0', '-2' ), + array( 'ceil -3', '-3' ), + array( 'floor -6.0', '-6' ), + array( 'ceil 4.2', '5' ), + array( 'ceil -4.5', '-4' ), + array( 'floor -4.5', '-5' ), + array( 'abs(-2)', '2' ), + array( 'ln(exp(1))', '1' ), + array( 'trunc(4.5)', '4' ), + array( 'trunc(-4.5)', '-4' ), + array( '123 fmod (2^64-1)', '123' ), + array( '5.7 mod 1.3', '0' ), + array( '5.7 fmod 1.3', '0.5' ), + ); + } +} + -- cgit v1.2.2