test/script/basic/JDK-8146147.js

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

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 1651
86ed55da74ab
permissions
-rw-r--r--

Merge

sundar@1651 1 /*
sundar@1651 2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
sundar@1651 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
sundar@1651 4 *
sundar@1651 5 * This code is free software; you can redistribute it and/or modify it
sundar@1651 6 * under the terms of the GNU General Public License version 2 only, as
sundar@1651 7 * published by the Free Software Foundation.
sundar@1651 8 *
sundar@1651 9 * This code is distributed in the hope that it will be useful, but WITHOUT
sundar@1651 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
sundar@1651 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
sundar@1651 12 * version 2 for more details (a copy is included in the LICENSE file that
sundar@1651 13 * accompanied this code).
sundar@1651 14 *
sundar@1651 15 * You should have received a copy of the GNU General Public License version
sundar@1651 16 * 2 along with this work; if not, write to the Free Software Foundation,
sundar@1651 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
sundar@1651 18 *
sundar@1651 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
sundar@1651 20 * or visit www.oracle.com if you need additional information or have any
sundar@1651 21 * questions.
sundar@1651 22 */
sundar@1651 23
sundar@1651 24 /**
sundar@1651 25 * JDK-8146147: Java linker indexed property getter does not work for computed nashorn string
sundar@1651 26 *
sundar@1651 27 * @test
sundar@1651 28 * @run
sundar@1651 29 */
sundar@1651 30
sundar@1651 31 var locale = java.util.Locale.ENGLISH;
sundar@1651 32 var prop = 'ISO3Language';
sundar@1651 33 var prop1 = 'ISO3';
sundar@1651 34 var prop2 = prop1 + 'Language';
sundar@1651 35 var prop3 = String(prop2);
sundar@1651 36
sundar@1651 37 function checkLang(obj) {
sundar@1651 38 if (obj != "eng") {
sundar@1651 39 throw new Error("FAILED: expected 'eng', got " + obj);
sundar@1651 40 }
sundar@1651 41 }
sundar@1651 42
sundar@1651 43 checkLang(locale.ISO3Language);
sundar@1651 44 checkLang(locale['ISO3Language']);
sundar@1651 45 checkLang(locale[prop]);
sundar@1651 46 checkLang(locale[prop1 + 'Language']);
sundar@1651 47 checkLang(locale[prop2]);
sundar@1651 48 checkLang(locale[prop3]);
sundar@1651 49 checkLang(locale[String(prop1 + 'Language')]);

mercurial