1 a normal string 2 line 0 3 line 1 4 Here is a long sentence 5 that may extend over 3 6 lines.!!!! 7 Here is a long sentence 8 that may extend over 4 9 lines. 10 !!!! 11 This is executed how 12 <html> 13 <head> 14 <title>Testing</title> 15 </head> 16 <body> 17 <p>This is a test.<p> 18 </body> 19 </html> 20 8 21 No we don't 22 /* 23 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 24 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25 * 26 * This code is free software; you can redistribute it and/or modify it 27 * under the terms of the GNU General Public License version 2 only, as 28 * published by the Free Software Foundation. 29 * 30 * This code is distributed in the hope that it will be useful, but WITHOUT 31 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 33 * version 2 for more details (a copy is included in the LICENSE file that 34 * accompanied this code). 35 * 36 * You should have received a copy of the GNU General Public License version 37 * 2 along with this work; if not, write to the Free Software Foundation, 38 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 39 * 40 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 41 * or visit www.oracle.com if you need additional information or have any 42 * questions. 43 */ 44 45 /** 46 * Edit strings test 47 * 48 * @test 49 * @option -scripting 50 * @run 51 */ 52 53 # scripting mode - shell style line comment works.. 54 55 var t = "normal"; 56 print("a ${t} string"); 57 58 // JavaScript style line comment works too.. 59 var i = 0; 60 print("line ${i++}\nline ${i++}"); 61 62 var c = 3; 63 print(<<EOD + "!!!!") 64 Here is a long sentence 65 that may extend over ${c} 66 lines. 67 EOD 68 69 c = 4; 70 print(<<<EOD + "!!!!") 71 Here is a long sentence 72 that may extend over ${c} 73 lines. 74 EOD 75 76 eval(<<BRAINTEASER); 77 print("This is executed how"); 78 BRAINTEASER 79 80 print(<<HTML); 81 <html> 82 <head> 83 <title>Testing</title> 84 </head> 85 <body> 86 <p>This is a test.<p> 87 </body> 88 </html> 89 HTML 90 91 var x = 1 92 << 93 3; 94 print(x); 95 96 var y = <<EOD; 97 There we go 98 EOD y = "No we don't"; 99 print(y); 100 101 102 print(readFully(__FILE__)); 103