From e5abc53701ba5a9b58dfaba3b59881c9c410a8e7 Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Sun, 15 Nov 2015 19:06:09 +0000 Subject: [PATCH] Use the same CS for all json tests --- ext/json/tests/002.phpt | 1 - ext/json/tests/006.phpt | 13 ++- ext/json/tests/007.phpt | 1 - ext/json/tests/bug40503.phpt | 8 +- ext/json/tests/bug41034.phpt | 2 +- ext/json/tests/bug41403.phpt | 2 - ext/json/tests/bug42785.phpt | 13 ++- ext/json/tests/bug46215.phpt | 8 +- ext/json/tests/bug46944.phpt | 4 +- ext/json/tests/bug47644.phpt | 4 +- ext/json/tests/bug54058.phpt | 4 +- ext/json/tests/bug54484.phpt | 2 - ext/json/tests/bug61978.phpt | 32 +++--- ext/json/tests/bug62369.phpt | 28 +++--- ext/json/tests/bug63737.phpt | 8 +- ext/json/tests/bug64874_part1.phpt | 6 +- ext/json/tests/bug64874_part2.phpt | 4 +- ext/json/tests/bug66021.phpt | 2 +- ext/json/tests/fail001.phpt | 65 ++++++------ ext/json/tests/json_decode_basic.phpt | 57 +++++------ ext/json/tests/json_decode_error.phpt | 15 +-- ext/json/tests/json_encode_basic.phpt | 98 +++++++++---------- ext/json/tests/json_encode_basic_utf8.phpt | 11 +-- ext/json/tests/json_encode_error.phpt | 16 +-- ext/json/tests/json_encode_numeric.phpt | 6 +- ext/json/tests/json_last_error_error.phpt | 5 +- ext/json/tests/json_last_error_msg_error.phpt | 4 +- ext/json/tests/pass001.1.phpt | 4 +- ext/json/tests/pass001.1_64bit.phpt | 4 +- ext/json/tests/pass001.phpt | 2 +- ext/json/tests/pass002.phpt | 4 +- ext/json/tests/pass003.phpt | 4 +- 32 files changed, 185 insertions(+), 252 deletions(-) diff --git a/ext/json/tests/002.phpt b/ext/json/tests/002.phpt index 5959d4a5f3..b562b616c8 100644 --- a/ext/json/tests/002.phpt +++ b/ext/json/tests/002.phpt @@ -20,7 +20,6 @@ var_dump(json_encode(array(), JSON_FORCE_OBJECT)); var_dump(json_encode(1)); var_dump(json_encode("руссиш")); - echo "Done\n"; ?> --EXPECTF-- diff --git a/ext/json/tests/006.phpt b/ext/json/tests/006.phpt index e1d4b46889..da2fe009f1 100644 --- a/ext/json/tests/006.phpt +++ b/ext/json/tests/006.phpt @@ -4,15 +4,14 @@ json_encode() & extended encoding --FILE-- ',"'bar'",'"baz"','&blong&'); +$a = array('', "'bar'", '"baz"', '&blong&'); echo "Normal: ", json_encode($a), "\n"; -echo "Tags: ", json_encode($a,JSON_HEX_TAG), "\n"; -echo "Apos: ", json_encode($a,JSON_HEX_APOS), "\n"; -echo "Quot: ", json_encode($a,JSON_HEX_QUOT), "\n"; -echo "Amp: ", json_encode($a,JSON_HEX_AMP), "\n"; -echo "All: ", json_encode($a,JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n"; +echo "Tags: ", json_encode($a, JSON_HEX_TAG), "\n"; +echo "Apos: ", json_encode($a, JSON_HEX_APOS), "\n"; +echo "Quot: ", json_encode($a, JSON_HEX_QUOT), "\n"; +echo "Amp: ", json_encode($a, JSON_HEX_AMP), "\n"; +echo "All: ", json_encode($a, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n"; ?> --EXPECT-- Normal: ["","'bar'","\"baz\"","&blong&"] diff --git a/ext/json/tests/007.phpt b/ext/json/tests/007.phpt index 7557ac9ed7..008d1dd5de 100644 --- a/ext/json/tests/007.phpt +++ b/ext/json/tests/007.phpt @@ -15,7 +15,6 @@ var_dump(json_last_error(), json_last_error_msg()); var_dump(json_decode("[1")); var_dump(json_last_error(), json_last_error_msg()); - echo "Done\n"; ?> --EXPECT-- diff --git a/ext/json/tests/bug40503.phpt b/ext/json/tests/bug40503.phpt index 48f18a4e0f..387ba299ec 100644 --- a/ext/json/tests/bug40503.phpt +++ b/ext/json/tests/bug40503.phpt @@ -6,14 +6,14 @@ precision=14 --FILE-- --EXPECT-- diff --git a/ext/json/tests/bug41034.phpt b/ext/json/tests/bug41034.phpt index cc7704122d..58ae281e6c 100644 --- a/ext/json/tests/bug41034.phpt +++ b/ext/json/tests/bug41034.phpt @@ -4,7 +4,7 @@ Bug #41034 (json_encode() ignores null byte started keys in arrays) --FILE-- 1,"\0null-prefixed value")); +echo json_encode(array(0, "\0ab"=>1, "\0null-prefixed value")); echo "\nDone\n"; ?> --EXPECT-- diff --git a/ext/json/tests/bug41403.phpt b/ext/json/tests/bug41403.phpt index 1a7343122a..f0e5f3b511 100644 --- a/ext/json/tests/bug41403.phpt +++ b/ext/json/tests/bug41403.phpt @@ -2,9 +2,7 @@ Bug #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.') --SKIPIF-- --FILE-- a = 100.10; $bar1->b = "foo"; diff --git a/ext/json/tests/bug46215.phpt b/ext/json/tests/bug46215.phpt index 0ac460cc15..be3a80f860 100644 --- a/ext/json/tests/bug46215.phpt +++ b/ext/json/tests/bug46215.phpt @@ -1,16 +1,12 @@ --TEST-- Bug #46215 (json_encode mutates its parameter and has some class-specific state) --SKIPIF-- - + --FILE-- > 2); - $second = 0x8f|($i & 3) << 4; + $first = 0xf0 | ($i >> 2); + $second = 0x8f | ($i & 3) << 4; $string = sprintf("aa%c%c\xbf\xbdzz", $first, $second); echo json_encode($string) . "\n"; } diff --git a/ext/json/tests/bug47644.phpt b/ext/json/tests/bug47644.phpt index 5e996b6973..85c4858af5 100644 --- a/ext/json/tests/bug47644.phpt +++ b/ext/json/tests/bug47644.phpt @@ -2,8 +2,8 @@ Bug #47644 (valid large integers are truncated) --SKIPIF-- --FILE-- $bad_utf8, - 'bar' => 1 + 'foo' => $bad_utf8, + 'bar' => 1 ); json_encode($c); var_dump(json_last_error(), json_last_error_msg()); diff --git a/ext/json/tests/bug54484.phpt b/ext/json/tests/bug54484.phpt index d698ab5416..3a38475019 100644 --- a/ext/json/tests/bug54484.phpt +++ b/ext/json/tests/bug54484.phpt @@ -10,11 +10,9 @@ var_dump(json_last_error()); json_decode(""); var_dump(json_last_error()); - json_decode("invalid json"); var_dump(json_last_error()); - json_decode(""); var_dump(json_last_error()); ?> diff --git a/ext/json/tests/bug61978.phpt b/ext/json/tests/bug61978.phpt index c34b03f8f7..56b92dc672 100644 --- a/ext/json/tests/bug61978.phpt +++ b/ext/json/tests/bug61978.phpt @@ -6,25 +6,25 @@ Bug #61978 (Object recursion not detected for classes that implement JsonSeriali test = '123'; - $this->me = $this; - } + public $test; + public $me; + public function __construct() { + $this->test = '123'; + $this->me = $this; + } } class JsonTest2 implements JsonSerializable { - public $test; - public function __construct() { - $this->test = '123'; - } - public function jsonSerialize() { - return array( - 'test' => $this->test, - 'me' => $this - ); - } + public $test; + public function __construct() { + $this->test = '123'; + } + public function jsonSerialize() { + return array( + 'test' => $this->test, + 'me' => $this + ); + } } diff --git a/ext/json/tests/bug62369.phpt b/ext/json/tests/bug62369.phpt index a5efd802c5..cf254bfc18 100644 --- a/ext/json/tests/bug62369.phpt +++ b/ext/json/tests/bug62369.phpt @@ -6,28 +6,28 @@ FR #62369 (Segfault on json_encode(deeply_nested_array) --EXPECT-- diff --git a/ext/json/tests/fail001.phpt b/ext/json/tests/fail001.phpt index 1bf9f12106..ea203746a6 100644 --- a/ext/json/tests/fail001.phpt +++ b/ext/json/tests/fail001.phpt @@ -2,43 +2,44 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/fail*.json) --SKIPIF-- --FILE-- diff --git a/ext/json/tests/json_decode_basic.phpt b/ext/json/tests/json_decode_basic.phpt index 6dbeadb367..0bc939c257 100644 --- a/ext/json/tests/json_decode_basic.phpt +++ b/ext/json/tests/json_decode_basic.phpt @@ -1,50 +1,41 @@ --TEST-- Test json_decode() function : basic functionality --SKIPIF-- - + --FILE-- diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt index 4d5d4e4bee..90a42889a0 100644 --- a/ext/json/tests/json_decode_error.phpt +++ b/ext/json/tests/json_decode_error.phpt @@ -1,26 +1,17 @@ --TEST-- Test json_decode() function : error conditions --SKIPIF-- - + --FILE-- ===Done=== diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt index fc348eed81..7fe855d1dc 100644 --- a/ext/json/tests/json_encode_basic.phpt +++ b/ext/json/tests/json_encode_basic.phpt @@ -1,18 +1,9 @@ --TEST-- Test json_encode() function : basic functionality --SKIPIF-- - + --FILE-- MyString = "Hello World"; // array with different values for $string $inputs = array ( + // integers + 0, + 123, + -123, + 2147483647, + -2147483648, - // integers -/*1*/ 0, - 123, - -123, - 2147483647, - -2147483648, + // floats + 123.456, + 1.23E3, + -1.23E3, - // floats -/*6*/ 123.456, - 1.23E3, - -1.23E3, - - // boolean -/*9*/ TRUE, - true, - FALSE, - false, + // boolean + TRUE, + true, + FALSE, + false, - // NULL -/*13*/ NULL, - null, - - // strings -/*15*/ "abc", - 'abc', - "Hello\t\tWorld\n", + // NULL + NULL, + null, - // arrays -/*18*/ array(), - array(1,2,3,4,5), - array(1 => "Sun", 2=>"Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"), - array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30), - - // empty data -/*22*/ "", - '', + // strings + "abc", + 'abc', + "Hello\t\tWorld\n", + + // arrays + array(), + array(1,2,3,4,5), + array(1 => "Sun", 2 => "Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"), + array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30), + + // empty data + "", + '', - // undefined data -/*24*/ @$undefined_var, + // undefined data + @$undefined_var, - // unset data -/*25*/ @$unset_var, + // unset data + @$unset_var, - // resource variable -/*26*/ $fp, + // resource variable + $fp, - // object variable -/*27*/ $obj + // object variable + $obj ); // loop through with each element of the $inputs array to test json_encode() function $count = 1; foreach($inputs as $input) { - echo "-- Iteration $count --\n"; - var_dump(json_encode($input)); - $count ++; + echo "-- Iteration $count --\n"; + var_dump(json_encode($input)); + $count ++; } ?> diff --git a/ext/json/tests/json_encode_basic_utf8.phpt b/ext/json/tests/json_encode_basic_utf8.phpt index a8e8b425ef..d03e83a8a9 100644 --- a/ext/json/tests/json_encode_basic_utf8.phpt +++ b/ext/json/tests/json_encode_basic_utf8.phpt @@ -1,18 +1,9 @@ --TEST-- Test json_encode() function : basic functionality with UTF8 string input --SKIPIF-- - + --FILE-- + --FILE-- ===Done=== diff --git a/ext/json/tests/json_encode_numeric.phpt b/ext/json/tests/json_encode_numeric.phpt index 5392350194..5850c4c959 100644 --- a/ext/json/tests/json_encode_numeric.phpt +++ b/ext/json/tests/json_encode_numeric.phpt @@ -1,11 +1,7 @@ --TEST-- Test json_encode() function with numeric flag --SKIPIF-- - + --FILE-- + --FILE-- --EXPECTF-- int(0) diff --git a/ext/json/tests/json_last_error_msg_error.phpt b/ext/json/tests/json_last_error_msg_error.phpt index 8135cf1ded..1a5f9d1bda 100644 --- a/ext/json/tests/json_last_error_msg_error.phpt +++ b/ext/json/tests/json_last_error_msg_error.phpt @@ -1,12 +1,12 @@ --TEST-- json_last_error_msg() failures --SKIPIF-- - + --FILE-- diff --git a/ext/json/tests/pass001.1.phpt b/ext/json/tests/pass001.1.phpt index a51f885780..611c40c4a4 100644 --- a/ext/json/tests/pass001.1.phpt +++ b/ext/json/tests/pass001.1.phpt @@ -4,8 +4,8 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json) precision=14 --SKIPIF-- --FILE-- --FILE-- --FILE-- + --FILE-- + --FILE--