Changeset View
Changeset View
Standalone View
Standalone View
src/parser/__tests__/PhutilJSONParserTestCase.php
Show All 16 Lines | $tests = array( | ||||
=> array('foo' => 'bar', 'bar' => array('baz' => 'foo')), | => array('foo' => 'bar', 'bar' => array('baz' => 'foo')), | ||||
'{"": ""}' => array('' => ''), | '{"": ""}' => array('' => ''), | ||||
'{"test":"\u00c9v\u00e9nement"}' | '{"test":"\u00c9v\u00e9nement"}' | ||||
=> array('test' => "\xC3\x89v\xC3\xA9nement"), | => array('test' => "\xC3\x89v\xC3\xA9nement"), | ||||
'["\u00c9v\u00e9nement"]' => array("\xC3\x89v\xC3\xA9nement"), | '["\u00c9v\u00e9nement"]' => array("\xC3\x89v\xC3\xA9nement"), | ||||
'{"test":"http:\/\/foo\\\\zomg"}' | '{"test":"http:\/\/foo\\\\zomg"}' | ||||
=> array('test' => 'http://foo\\zomg'), | => array('test' => 'http://foo\\zomg'), | ||||
'["http:\/\/foo\\\\zomg"]' => array('http://foo\\zomg'), | '["http:\/\/foo\\\\zomg"]' => array('http://foo\\zomg'), | ||||
Filesystem::readFile(dirname(__FILE__).'/json/base64.json') => array( | |||||
'action' => 'candidate.create', | |||||
'actionId' => '80653a26cc46357ff79ff83b47e27c3cb7a668bd', | |||||
'params' => array( | |||||
'attachments' => array( | |||||
Filesystem::readFile(dirname(__FILE__).'/json/base64.data'), | |||||
), | |||||
), | |||||
), | |||||
); | ); | ||||
foreach ($tests as $input => $expect) { | foreach ($tests as $input => $expect) { | ||||
$this->assertEqual( | $this->assertEqual( | ||||
$expect, | $expect, | ||||
$parser->parse($input), | $parser->parse($input), | ||||
'Parsing JSON: '.$input); | 'Parsing JSON: '.$input); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |