test/nashorn/script/basic/JDK-8074687.js
author hannesw
Mon, 23 Apr 2018 17:45:05 +0200
changeset 49855 3739e9a5b6b5
parent 47216 71c04702a3d5
permissions -rw-r--r--
8201466: Nashorn: defineProperty setters/getters on prototype object ignored with numeric property names Reviewed-by: sundar, jlaskey
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29408
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     1
/*
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     4
 * 
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     7
 * published by the Free Software Foundation.
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     8
 * 
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    13
 * accompanied this code).
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    14
 * 
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    18
 * 
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    21
 * questions.
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    22
 */
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    23
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    24
/**
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    25
 * JDK-8074687:  Add tests for JSON parsing of numeric keys
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    26
 *
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    27
 * @test
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    28
 * @run
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    29
 */
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    30
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    31
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {} }')),                   '{"0":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    32
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1 }')),                    '{"0":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    33
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    34
Assert.assertEquals(JSON.stringify(JSON.parse('{ "65503": {} }')),               '{"65503":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    35
Assert.assertEquals(JSON.stringify(JSON.parse('{ "65503": 1 }')),                '{"65503":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    36
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {}, "65503": {} }')),      '{"0":{},"65503":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    37
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1, "65503": 1 }')),        '{"0":1,"65503":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    38
Assert.assertEquals(JSON.stringify(JSON.parse('{ "65503": {}, "0": {} }')),      '{"0":{},"65503":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    39
Assert.assertEquals(JSON.stringify(JSON.parse('{ "65503": 1, "0": 1 }')),        '{"0":1,"65503":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    40
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    41
Assert.assertEquals(JSON.stringify(JSON.parse('{ "4294967295": {} }')),          '{"4294967295":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    42
Assert.assertEquals(JSON.stringify(JSON.parse('{ "4294967295": 1 }')),           '{"4294967295":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    43
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {}, "4294967295": {} }')), '{"0":{},"4294967295":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    44
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1, "4294967295": 1 }')),   '{"0":1,"4294967295":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    45
Assert.assertEquals(JSON.stringify(JSON.parse('{ "4294967295": {}, "0": {} }')), '{"0":{},"4294967295":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    46
Assert.assertEquals(JSON.stringify(JSON.parse('{ "4294967295": 1, "0": 1 }')),   '{"0":1,"4294967295":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    47
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    48
Assert.assertEquals(JSON.stringify(JSON.parse('{ "100": {} }')),                 '{"100":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    49
Assert.assertEquals(JSON.stringify(JSON.parse('{ "100": 1 }')),                  '{"100":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    50
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {}, "100": {} }')),        '{"0":{},"100":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    51
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1, "100": 1 }')),          '{"0":1,"100":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    52
Assert.assertEquals(JSON.stringify(JSON.parse('{ "100": {}, "0": {} }')),        '{"0":{},"100":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    53
Assert.assertEquals(JSON.stringify(JSON.parse('{ "100": 1, "0": 1 }')),          '{"0":1,"100":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    54
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    55
Assert.assertEquals(JSON.stringify(JSON.parse('{ "-100": {} }')),                '{"-100":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    56
Assert.assertEquals(JSON.stringify(JSON.parse('{ "-100": 1 }')),                 '{"-100":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    57
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": {}, "-100": {} }')),       '{"0":{},"-100":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    58
Assert.assertEquals(JSON.stringify(JSON.parse('{ "0": 1, "-100": 1 }')),         '{"0":1,"-100":1}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    59
Assert.assertEquals(JSON.stringify(JSON.parse('{ "-100": {}, "0": {} }')),       '{"0":{},"-100":{}}');
10333b1b7402 8074687: Add tests for JSON parsing of numeric keys
hannesw
parents:
diff changeset
    60
Assert.assertEquals(JSON.stringify(JSON.parse('{ "-100": 1, "0": 1 }')),         '{"0":1,"-100":1}');