Annotation of embedaddon/php/ext/json/tests/fail001.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: JSON (http://www.crockford.com/JSON/JSON_checker/test/fail*.json)
        !             3: --SKIPIF--
        !             4: <?php
        !             5:   if (!extension_loaded('json')) die('skip: json extension not available');
        !             6: ?>
        !             7: --FILE--
        !             8: <?php
        !             9:     
        !            10: $tests = array('"A JSON payload should be an object or array, not a string."',
        !            11:                '["Unclosed array"',
        !            12:                '{unquoted_key: "keys must be quoted}',
        !            13:                '["extra comma",]',
        !            14:                '["double extra comma",,]',
        !            15:                '[   , "<-- missing value"]',
        !            16:                '["Comma after the close"],',
        !            17:                '["Extra close"]]',
        !            18:                '{"Extra comma": true,}',
        !            19:                '{"Extra value after close": true} "misplaced quoted value"',
        !            20:                '{"Illegal expression": 1 + 2}',
        !            21:                '{"Illegal invocation": alert()}',
        !            22:                '{"Numbers cannot have leading zeroes": 013}',
        !            23:                '{"Numbers cannot be hex": 0x14}',
        !            24:                '["Illegal backslash escape: \\x15"]',
        !            25:                '["Illegal backslash escape: \\\'"]',
        !            26:                '["Illegal backslash escape: \\017"]',
        !            27:                '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
        !            28:                '{"Missing colon" null}',
        !            29:                '{"Double colon":: null}',
        !            30:                '{"Comma instead of colon", null}',
        !            31:                '["Colon instead of comma": false]',
        !            32:                '["Bad value", truth]',
        !            33:                "['single quote']");
        !            34: 
        !            35: foreach ($tests as $test)
        !            36: {
        !            37:     echo 'Testing: ' . $test . "\n";
        !            38:     echo "AS OBJECT\n";
        !            39:     var_dump(json_decode($test));
        !            40:     echo "AS ARRAY\n";
        !            41:     var_dump(json_decode($test, true));
        !            42: }
        !            43: 
        !            44: ?>
        !            45: --EXPECT--
        !            46: Testing: "A JSON payload should be an object or array, not a string."
        !            47: AS OBJECT
        !            48: string(58) "A JSON payload should be an object or array, not a string."
        !            49: AS ARRAY
        !            50: string(58) "A JSON payload should be an object or array, not a string."
        !            51: Testing: ["Unclosed array"
        !            52: AS OBJECT
        !            53: NULL
        !            54: AS ARRAY
        !            55: NULL
        !            56: Testing: {unquoted_key: "keys must be quoted}
        !            57: AS OBJECT
        !            58: NULL
        !            59: AS ARRAY
        !            60: NULL
        !            61: Testing: ["extra comma",]
        !            62: AS OBJECT
        !            63: NULL
        !            64: AS ARRAY
        !            65: NULL
        !            66: Testing: ["double extra comma",,]
        !            67: AS OBJECT
        !            68: NULL
        !            69: AS ARRAY
        !            70: NULL
        !            71: Testing: [   , "<-- missing value"]
        !            72: AS OBJECT
        !            73: NULL
        !            74: AS ARRAY
        !            75: NULL
        !            76: Testing: ["Comma after the close"],
        !            77: AS OBJECT
        !            78: NULL
        !            79: AS ARRAY
        !            80: NULL
        !            81: Testing: ["Extra close"]]
        !            82: AS OBJECT
        !            83: NULL
        !            84: AS ARRAY
        !            85: NULL
        !            86: Testing: {"Extra comma": true,}
        !            87: AS OBJECT
        !            88: NULL
        !            89: AS ARRAY
        !            90: NULL
        !            91: Testing: {"Extra value after close": true} "misplaced quoted value"
        !            92: AS OBJECT
        !            93: NULL
        !            94: AS ARRAY
        !            95: NULL
        !            96: Testing: {"Illegal expression": 1 + 2}
        !            97: AS OBJECT
        !            98: NULL
        !            99: AS ARRAY
        !           100: NULL
        !           101: Testing: {"Illegal invocation": alert()}
        !           102: AS OBJECT
        !           103: NULL
        !           104: AS ARRAY
        !           105: NULL
        !           106: Testing: {"Numbers cannot have leading zeroes": 013}
        !           107: AS OBJECT
        !           108: NULL
        !           109: AS ARRAY
        !           110: NULL
        !           111: Testing: {"Numbers cannot be hex": 0x14}
        !           112: AS OBJECT
        !           113: NULL
        !           114: AS ARRAY
        !           115: NULL
        !           116: Testing: ["Illegal backslash escape: \x15"]
        !           117: AS OBJECT
        !           118: NULL
        !           119: AS ARRAY
        !           120: NULL
        !           121: Testing: ["Illegal backslash escape: \'"]
        !           122: AS OBJECT
        !           123: NULL
        !           124: AS ARRAY
        !           125: NULL
        !           126: Testing: ["Illegal backslash escape: \017"]
        !           127: AS OBJECT
        !           128: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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
        !           132: AS OBJECT
        !           133: NULL
        !           134: AS ARRAY
        !           135: NULL
        !           136: Testing: {"Missing colon" null}
        !           137: AS OBJECT
        !           138: NULL
        !           139: AS ARRAY
        !           140: NULL
        !           141: Testing: {"Double colon":: null}
        !           142: AS OBJECT
        !           143: NULL
        !           144: AS ARRAY
        !           145: NULL
        !           146: Testing: {"Comma instead of colon", null}
        !           147: AS OBJECT
        !           148: NULL
        !           149: AS ARRAY
        !           150: NULL
        !           151: Testing: ["Colon instead of comma": false]
        !           152: AS OBJECT
        !           153: NULL
        !           154: AS ARRAY
        !           155: NULL
        !           156: Testing: ["Bad value", truth]
        !           157: AS OBJECT
        !           158: NULL
        !           159: AS ARRAY
        !           160: NULL
        !           161: Testing: ['single quote']
        !           162: AS OBJECT
        !           163: NULL
        !           164: AS ARRAY
        !           165: NULL
        !           166: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>