NASHORN-46.js revision 2:da1e581c933b
13197Scsgr/* 250476Speter * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. 31592Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4298107Sgjb * 5301242Slidl * This code is free software; you can redistribute it and/or modify it 6301242Slidl * under the terms of the GNU General Public License version 2 only, as 7301242Slidl * published by the Free Software Foundation. 81592Srgrimes * 974814Sru * This code is distributed in the hope that it will be useful, but WITHOUT 101592Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11298107Sgjb * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12298107Sgjb * version 2 for more details (a copy is included in the LICENSE file that 13201380Sed * accompanied this code). 1490164Skris * 153197Scsgr * You should have received a copy of the GNU General Public License version 16275077Sbapt * 2 along with this work; if not, write to the Free Software Foundation, 1725099Sdavidn * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18301242Slidl * 19301242Slidl * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20301242Slidl * or visit www.oracle.com if you need additional information or have any 21301242Slidl * questions. 22301242Slidl */ 23301242Slidl 241592Srgrimes/** 25 * NASHORN-46 : 'with' statement can not have 'null' as scope object. 26 * 27 * @test 28 * @run 29 */ 30 31try { 32 with(null) { 33 print("TypeError expected!!"); 34 } 35} catch (e) { 36 print(e); 37} 38 39try { 40 with(undefined) { 41 print("TypeError expected!!"); 42 } 43} catch (e) { 44 print(e); 45} 46