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