|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * LineTerminator between return and Identifier_opt yields return without Identifier_opt |
|
6 * |
|
7 * @path ch12/12.9/S12.9_A2.js |
|
8 * @description Checking by using eval, inserting LineTerminator between return and Variable |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 try{ |
|
13 if (eval("(function(){var x = 1;return\u000Ax;var y=2;})()") !== undefined) { |
|
14 $ERROR("#1: LineTerminator(U-000A) between return and Identifier_opt yields return without Identifier_opt"); |
|
15 } |
|
16 } catch(e){ |
|
17 $ERROR('#1: eval("(function(){var x = 1;return\\u000Ax;var y=2;})()") does not lead to throwing exception'); |
|
18 } |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 //CHECK#2 |
|
24 try{ |
|
25 if (eval("(function(){var x = 1;return\u000Dx;var y=2;})()") !== undefined) { |
|
26 $ERROR("#1: LineTerminator(U-000D) between return and Identifier_opt yields return without Identifier_opt"); |
|
27 } |
|
28 } catch(e){ |
|
29 $ERROR('#2: eval("(function(){var x = 1;return\\u000Dx;var y=2;})()") does not lead to throwing exception'); |
|
30 } |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 //CHECK#3 |
|
36 try{ |
|
37 if (eval("(function(){var x = 1;return\u2028x;var y=2;})()") !== undefined) { |
|
38 $ERROR("#1: LineTerminator(U-2028) between return and Identifier_opt yields return without Identifier_opt"); |
|
39 } |
|
40 } catch(e){ |
|
41 $ERROR('#3: eval("(function(){var x = 1;return\\u2028x;var y=2;})()") does not lead to throwing exception'); |
|
42 } |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 //CHECK#4 |
|
48 try{ |
|
49 if (eval("(function(){var x =1;return\u2029x;var y=2;})()") !== undefined) { |
|
50 $ERROR("#1: LineTerminator(U-2029) between return and Identifier_opt yields return without Identifier_opt"); |
|
51 } |
|
52 } catch(e){ |
|
53 $ERROR('#4: eval("(function(){var x =1;return\\u2029x;var y=2;})()") does not lead to throwing exception'); |
|
54 } |
|
55 |