Bartosz Dziewoński has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383443 )

Change subject: Add test cases for digit grouping (commafy) in Polish
......................................................................

Add test cases for digit grouping (commafy) in Polish

According to the typographical convention, a thousands separator
should not be inserted in numbers that are four digits long (between
1000 and 9999), unlike in English where it's usually acceptable.
This logic is currently implemented in LanguagePl::commafy().

Bug: T177846
Change-Id: I6dbd8febcf59000067cdd7d3c11111f2f77f4e66
---
M tests/phpunit/languages/classes/LanguagePlTest.php
1 file changed, 27 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/43/383443/1

diff --git a/tests/phpunit/languages/classes/LanguagePlTest.php 
b/tests/phpunit/languages/classes/LanguagePlTest.php
index a6d0f2e..d7a0074 100644
--- a/tests/phpunit/languages/classes/LanguagePlTest.php
+++ b/tests/phpunit/languages/classes/LanguagePlTest.php
@@ -74,4 +74,31 @@
                        [ 'other', 201 ],
                ];
        }
+
+       /**
+        * @covers LanguagePl::commafy()
+        * @dataProvider provideCommafyData
+        */
+       public function testCommafy( $number, $numbersWithCommas ) {
+               $this->assertEquals(
+                       $numbersWithCommas,
+                       $this->getLang()->commafy( $number ),
+                       "commafy('$number')"
+               );
+       }
+
+       public static function provideCommafyData() {
+               // Note that commafy() always uses English separators (',' and 
'.') instead of
+               // Polish (' ' and ','). There is another function that 
converts them later.
+               return [
+                       [ 1000, '1000' ],
+                       [ 10000, '10,000' ],
+                       [ 1000.0001, '1000.0001' ],
+                       [ 10000.0001, '10,000.0001' ],
+                       [ -1000, '-1000' ],
+                       [ -10000, '-10,000' ],
+                       [ -1000.0001, '-1000.0001' ],
+                       [ -10000.0001, '-10,000.0001' ],
+               ];
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/383443
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dbd8febcf59000067cdd7d3c11111f2f77f4e66
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to