JDK-8068872.js revision 1179:2b9af466a49d
1294332Sdes/*
2124208Sdes * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3124208Sdes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4124208Sdes *
5294332Sdes * This code is free software; you can redistribute it and/or modify it
6294332Sdes * under the terms of the GNU General Public License version 2 only, as
7294332Sdes * published by the Free Software Foundation.
8124208Sdes *
9124208Sdes * This code is distributed in the hope that it will be useful, but WITHOUT
10124208Sdes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11124208Sdes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12124208Sdes * version 2 for more details (a copy is included in the LICENSE file that
13124208Sdes * accompanied this code).
14124208Sdes *
15124208Sdes * You should have received a copy of the GNU General Public License version
16124208Sdes * 2 along with this work; if not, write to the Free Software Foundation,
17124208Sdes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18124208Sdes *
19124208Sdes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20124208Sdes * or visit www.oracle.com if you need additional information or have any
21124208Sdes * questions.
22124208Sdes */
23323134Sdes
24323134Sdes/**
25162852Sdes * JDK-8068872:  Nashorn JSON.parse drops numeric keys
26294332Sdes *
27124208Sdes * @test
28162852Sdes * @run
29294328Sdes */
30124208Sdes
31124208Sdesprint(JSON.stringify(JSON.parse('{"3": 1, "5": "a"}')));
32124208Sdesprint(JSON.stringify(JSON.parse('{"5": 1, "3": "a"}')));
33124208Sdesprint(JSON.stringify(JSON.parse('{"0": 1, "4294967294": "a"}')));
34124208Sdesprint(JSON.stringify(JSON.parse('{"4294967294": 1, "0": "a"}')));
35124208Sdes