JDK-8026033.js revision 591:8c326f8c6799
1142425Snectar/*
2160814Ssimon * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3142425Snectar * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4142425Snectar *
5142425Snectar * This code is free software; you can redistribute it and/or modify it
6142425Snectar * under the terms of the GNU General Public License version 2 only, as
7142425Snectar * published by the Free Software Foundation.
8142425Snectar *
9142425Snectar * This code is distributed in the hope that it will be useful, but WITHOUT
10142425Snectar * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11142425Snectar * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12142425Snectar * version 2 for more details (a copy is included in the LICENSE file that
13142425Snectar * accompanied this code).
14142425Snectar *
15142425Snectar * You should have received a copy of the GNU General Public License version
16142425Snectar * 2 along with this work; if not, write to the Free Software Foundation,
17142425Snectar * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18142425Snectar *
19142425Snectar * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20142425Snectar * or visit www.oracle.com if you need additional information or have any
21142425Snectar * questions.
22142425Snectar */
23142425Snectar
24142425Snectar/**
25142425Snectar * JDK-8026033: Switch should load expression even when there are no cases in it
26142425Snectar *
27142425Snectar * @test
28142425Snectar * @run
29142425Snectar */
30142425Snectar
31142425Snectartry {
32142425Snectar    (function() { switch(x) {} })();
33142425Snectar    fail("Should have thrown ReferenceError");
34142425Snectar} catch (e) {
35142425Snectar    if (! (e instanceof ReferenceError)) {
36142425Snectar        fail("ReferenceError expected, got " + e);
37142425Snectar    }
38142425Snectar    print(e);
39142425Snectar}
40142425Snectar