NASHORN-711.js revision 6:5a1b0714df0e
1251241Sdas/*
2251241Sdas * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3251241Sdas * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4251241Sdas *
5251241Sdas * This code is free software; you can redistribute it and/or modify it
6251241Sdas * under the terms of the GNU General Public License version 2 only, as
7251241Sdas * published by the Free Software Foundation.
8251241Sdas *
9251241Sdas * This code is distributed in the hope that it will be useful, but WITHOUT
10251241Sdas * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11251241Sdas * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12251241Sdas * version 2 for more details (a copy is included in the LICENSE file that
13251241Sdas * accompanied this code).
14251241Sdas *
15251241Sdas * You should have received a copy of the GNU General Public License version
16251241Sdas * 2 along with this work; if not, write to the Free Software Foundation,
17251241Sdas * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18251241Sdas *
19251241Sdas * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20251241Sdas * or visit www.oracle.com if you need additional information or have any
21251241Sdas * questions.
22251241Sdas */
23251241Sdas
24251241Sdas/*
25251241Sdas * NASHORN-711 - Strings broken to multiple lines throw out the line numbering.
26251241Sdas *
27251241Sdas * @test
28251241Sdas * @option -scripting
29251241Sdas * @run
30251241Sdas */
31251241Sdas
32251241Sdasvar x = "aaa\\aaa\r\naaaaa\
33251241Sdasbbbb\"bb\rbbb\
34251241Sdascccccccc";
35251241Sdas
36251241Sdasprint("current line:", new java.lang.Throwable().getStackTrace()[0].getLineNumber());
37251241Sdastry {
38251241Sdas    throw new Error();
39251241Sdas} catch (error) {
40251241Sdas    print("thrown in line:", error.lineNumber);
41251241Sdas}
42251241Sdas
43251241Sdas<<END
44251241Sdasaaaaaaaaa
45251241Sdasbbbbbbbbb
46251241Sdasccccccccc
47251241SdasEND
48251241Sdas
49251241Sdasprint("current line:", new java.lang.Throwable().getStackTrace()[0].getLineNumber());
50251241Sdastry {
51251241Sdas    throw new Error();
52251241Sdas} catch (error) {
53251241Sdas    print("thrown in line:", error.lineNumber);
54251241Sdas}
55251241Sdas