NASHORN-397.js revision 6:5a1b0714df0e
1234744Sjamie/* 2214117Sjamie * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 3214117Sjamie * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4214117Sjamie * 5214117Sjamie * This code is free software; you can redistribute it and/or modify it 6214117Sjamie * under the terms of the GNU General Public License version 2 only, as 7214117Sjamie * published by the Free Software Foundation. 8214117Sjamie * 9214117Sjamie * This code is distributed in the hope that it will be useful, but WITHOUT 10214117Sjamie * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11214117Sjamie * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12214117Sjamie * version 2 for more details (a copy is included in the LICENSE file that 13214117Sjamie * accompanied this code). 14214117Sjamie * 15214117Sjamie * You should have received a copy of the GNU General Public License version 16214117Sjamie * 2 along with this work; if not, write to the Free Software Foundation, 17214117Sjamie * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18214117Sjamie * 19214117Sjamie * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20214117Sjamie * or visit www.oracle.com if you need additional information or have any 21214117Sjamie * questions. 22214117Sjamie */ 23214117Sjamie 24214117Sjamie/** 25214117Sjamie * NASHORN-397 : typeof on certain member access expressions computes to undefined wrongly 26214117Sjamie * 27262836Szeising * @test 28214117Sjamie * @run 29214117Sjamie */ 30214117Sjamie 31214117SjamieObject.defineProperty(Number.prototype, 'x', 32214117Sjamie { get : function() { return 42; } }); 33214117Sjamie 34214117Sjamieif (typeof (5).x !== 'number') { 35214117Sjamie fail("typeof(5).x is not 'number'"); 36214117Sjamie} 37214117Sjamie 38214117Sjamieif (typeof (java.lang.System.out) != 'object') { 39214117Sjamie fail("typeof java.lang.System.out is not 'object'"); 40235337Sgjb} 41214117Sjamie 42214117Sjamieif (typeof (java.lang.Math.PI) != 'number') { 43214117Sjamie fail("typeof java.lang.Math.PI is not 'number'"); 44214117Sjamie} 45214117Sjamie 46214117Sjamieif (typeof (java.io.File.separator) != 'string') { 47214117Sjamie fail("typeof java.io.File.separator is not 'string'"); 48214117Sjamie} 49214117Sjamie