test/script/basic/JDK-8087312.js

Tue, 21 Mar 2017 13:41:57 -0700

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1546
52059be6cb70
permissions
-rw-r--r--

Merge

hannesw@1546 1 /*
hannesw@1546 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
hannesw@1546 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
hannesw@1546 4 *
hannesw@1546 5 * This code is free software; you can redistribute it and/or modify it
hannesw@1546 6 * under the terms of the GNU General Public License version 2 only, as
hannesw@1546 7 * published by the Free Software Foundation.
hannesw@1546 8 *
hannesw@1546 9 * This code is distributed in the hope that it will be useful, but WITHOUT
hannesw@1546 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
hannesw@1546 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
hannesw@1546 12 * version 2 for more details (a copy is included in the LICENSE file that
hannesw@1546 13 * accompanied this code).
hannesw@1546 14 *
hannesw@1546 15 * You should have received a copy of the GNU General Public License version
hannesw@1546 16 * 2 along with this work; if not, write to the Free Software Foundation,
hannesw@1546 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
hannesw@1546 18 *
hannesw@1546 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
hannesw@1546 20 * or visit www.oracle.com if you need additional information or have any
hannesw@1546 21 * questions.
hannesw@1546 22 */
hannesw@1546 23
hannesw@1546 24 /**
hannesw@1546 25 * JDK-8087312: PropertyMapWrapper.equals should compare className
hannesw@1546 26 *
hannesw@1546 27 * @test
hannesw@1546 28 * @run
hannesw@1546 29 * @fork
hannesw@1546 30 * @option -Dnashorn.debug=true
hannesw@1546 31 */
hannesw@1546 32
hannesw@1546 33 function createObject(type) {
hannesw@1546 34 // we want to make sure two different object literals with the same keys and types share the same property map.
hannesw@1546 35 if (type) {
hannesw@1546 36 return {
hannesw@1546 37 a: "a",
hannesw@1546 38 b: 1,
hannesw@1546 39 c: 0.1
hannesw@1546 40 }
hannesw@1546 41 } else {
hannesw@1546 42 return {
hannesw@1546 43 a: "x",
hannesw@1546 44 b: 10,
hannesw@1546 45 c: 3.4
hannesw@1546 46 }
hannesw@1546 47 }
hannesw@1546 48 }
hannesw@1546 49
hannesw@1546 50 var o1 = createObject(false);
hannesw@1546 51 var o2 = createObject(true);
hannesw@1546 52 Assert.assertTrue(Debug.map(o1) === Debug.map(o2));
hannesw@1546 53

mercurial