r96717 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96716‎ | r96717 | r96718 >
Date:07:15, 10 September 2011
Author:dantman
Status:resolved (Comments)
Tags:
Comment:
Add some other ServicesJson tests.
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/json/ServicesJsonTest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/json/ServicesJsonTest.php
@@ -54,18 +54,40 @@
5555 $obj->property3 = 1.234;
5656 return array(
5757 array( 1, 'basic integer' ),
 58+ array( -1, 'negative integer' ),
 59+ array( 1.1, 'basic float' ),
5860 array( true, 'basic bool true' ),
5961 array( false, 'basic bool false' ),
6062 array( 'some string', 'basic string test' ),
 63+ array( "some string\nwith newline", 'newline string test' ),
 64+ array( '♥ü', 'unicode string test' ),
6165 array( array( 'some', 'string', 'values' ), 'basic array of strings' ),
6266 array( array( 'key1' => 'val1', 'key2' => 'val2' ), 'array with string keys' ),
 67+ array( array( 1 => 'val1', 3 => 'val2', '2' => 'val3' ), 'out of order numbered array test' ),
 68+ array( array(), 'empty array test' ),
6369 array( $obj, 'basic object test' ),
 70+ array( new stdClass, 'empty object test' ),
 71+ array( null, 'null test' ),
6472 );
6573 }
6674
6775 function provideValuesToDecode() {
6876 return array(
 77+ array( '1', 'basic integer' ),
 78+ array( '-1', 'negative integer' ),
 79+ array( '1.1', 'basic float' ),
 80+ array( '1.1e1', 'scientific float' ),
 81+ array( 'true', 'basic bool true' ),
 82+ array( 'false', 'basic bool false' ),
 83+ array( '"some string"', 'basic string test' ),
 84+ array( '"some string\nwith newline"', 'newline string test' ),
 85+ array( '"♥ü"', 'unicode character string test' ),
 86+ array( '"\u2665"', 'unicode \\u string test' ),
 87+ array( '["some","string","values"]', 'basic array of strings' ),
 88+ array( '[]', 'empty array test' ),
6989 array( '{"key":"value"}', 'Basic key => value test' ),
 90+ array( '{}', 'empty object test' ),
 91+ array( 'null', 'null test' ),
7092 );
7193 }
7294 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r98049Followup r96717; Fix whitespace.dantman02:09, 25 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96713Add some basic tests to compare output of native json support and the Service...demon05:24, 10 September 2011

Comments

#Comment by 😂 (talk | contribs)   07:19, 10 September 2011

Awesome, thanks for the additional testcases! Mismatched spaces/tabs in provideValuesToDecode() needs fixing though :)

#Comment by Dantman (talk | contribs)   07:20, 10 September 2011

nano ft(l)?

Status & tagging log