test/script/basic/JDK-8028434.js

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

author
asaha
date
Tue, 21 Mar 2017 13:41:57 -0700
changeset 2160
1df40fe54cd6
parent 962
ac62e33a99b0
child 1205
4112748288bb
permissions
-rw-r--r--

Merge

lagergren@679 1 /*
lagergren@679 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
lagergren@679 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
attila@962 4 *
lagergren@679 5 * This code is free software; you can redistribute it and/or modify it
lagergren@679 6 * under the terms of the GNU General Public License version 2 only, as
lagergren@679 7 * published by the Free Software Foundation.
attila@962 8 *
lagergren@679 9 * This code is distributed in the hope that it will be useful, but WITHOUT
lagergren@679 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
lagergren@679 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
lagergren@679 12 * version 2 for more details (a copy is included in the LICENSE file that
lagergren@679 13 * accompanied this code).
attila@962 14 *
lagergren@679 15 * You should have received a copy of the GNU General Public License version
lagergren@679 16 * 2 along with this work; if not, write to the Free Software Foundation,
lagergren@679 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
attila@962 18 *
lagergren@679 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
lagergren@679 20 * or visit www.oracle.com if you need additional information or have any
lagergren@679 21 * questions.
lagergren@679 22 */
lagergren@679 23
lagergren@679 24 /**
lagergren@679 25 * JDK-8028434: Check that the line number of the tests in while and do while loops
lagergren@679 26 * is correct. It needs to correspond to the line with the test expression.
lagergren@679 27 *
lagergren@679 28 * @test
lagergren@679 29 * @run
lagergren@679 30 */
lagergren@679 31
lagergren@679 32 try {
lagergren@679 33 while (test.apa < 0) {
attila@962 34 print("x");
lagergren@679 35 }
lagergren@679 36 } catch (e) {
lagergren@679 37 var st = e.getStackTrace();
lagergren@679 38 if (st.length != 1) {
attila@962 39 print("erroneous stacktrace length " + s.length);
lagergren@679 40 }
lagergren@680 41 if (st[0].lineNumber !== 33) {
attila@962 42 print("erroneous stacktrace element, lineNumber=" + st[0].lineNumber + " elem=" + st);
lagergren@679 43 }
lagergren@679 44 }
lagergren@679 45
lagergren@679 46 try {
lagergren@679 47 do {
attila@962 48 print("x");
lagergren@679 49 } while (test.apa < 0);
lagergren@679 50 } catch (e) {
lagergren@679 51 var st = e.getStackTrace();
lagergren@679 52 if (st.length != 1) {
attila@962 53 print("erroneous stacktrace length " + s.length);
lagergren@679 54 }
lagergren@680 55 if (st[0].lineNumber !== 49) {
attila@962 56 print("erroneous stacktrace element, lineNumber= " + st[0].lineNumber + " elem=" + st);
lagergren@679 57 }
lagergren@679 58 }

mercurial