r103128 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103127‎ | r103128 | r103129 >
Date:04:28, 15 November 2011
Author:santhosh
Status:ok
Tags:
Comment:
Follow up r102802. Bug 32359
Use negative sign itself instead of $_[0] since $_ is mixed type.
Add more test cases.
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)
  • /trunk/phase3/tests/phpunit/languages/LanguageMlTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/languages/LanguageMlTest.php
@@ -28,5 +28,7 @@
2929 $this->assertEquals( '.12345', $this->lang->formatNum( '.12345' ) );
3030 $this->assertEquals( '-12,00,000', $this->lang->formatNum( '-1200000' ) );
3131 $this->assertEquals( '-98', $this->lang->formatNum( '-98' ) );
 32+ $this->assertEquals( '-98', $this->lang->formatNum( -98 ) );
 33+ $this->assertEquals( '-1,23,45,678', $this->lang->formatNum( -12345678 ) );
3234 }
3335 }
Index: trunk/phase3/languages/Language.php
@@ -2725,7 +2725,7 @@
27262726 $sign = "";
27272727 if ( intval( $_ ) < 0 ) {
27282728 // For negative numbers apply the algorithm like positive number and add sign.
2729 - $sign = $_[0];
 2729+ $sign = "-";
27302730 $_ = substr( $_,1 );
27312731 }
27322732 $numberpart = array();

Follow-up revisions

RevisionCommit summaryAuthorDate
r105202MFT r99905 r100958 r101995 r103128 r103168 r103173 r103646 r103802 r103804 r1...nikerabbit18:38, 5 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102802Make commafy support negative numbers too,...santhosh17:23, 11 November 2011

Status & tagging log