js/src/tests/test262/ch12/12.9/S12.9_A2.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/test262/ch12/12.9/S12.9_A2.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +// Copyright 2009 the Sputnik authors.  All rights reserved.
     1.5 +// This code is governed by the BSD license found in the LICENSE file.
     1.6 +
     1.7 +/**
     1.8 + * LineTerminator between return and Identifier_opt yields return without Identifier_opt
     1.9 + *
    1.10 + * @path ch12/12.9/S12.9_A2.js
    1.11 + * @description Checking by using eval, inserting LineTerminator between return and Variable
    1.12 + */
    1.13 +
    1.14 +//CHECK#1
    1.15 +try{
    1.16 +  if (eval("(function(){var x = 1;return\u000Ax;var y=2;})()") !== undefined) {
    1.17 +    $ERROR("#1: LineTerminator(U-000A) between return and Identifier_opt yields return without Identifier_opt");	  
    1.18 +  }
    1.19 +} catch(e){
    1.20 +  $ERROR('#1: eval("(function(){var x = 1;return\\u000Ax;var y=2;})()") does not lead to throwing exception');
    1.21 +}
    1.22 +
    1.23 +
    1.24 +
    1.25 +
    1.26 +//CHECK#2
    1.27 +try{
    1.28 +  if (eval("(function(){var x = 1;return\u000Dx;var y=2;})()") !== undefined) {
    1.29 +    $ERROR("#1: LineTerminator(U-000D) between return and Identifier_opt yields return without Identifier_opt");    
    1.30 +  }
    1.31 +} catch(e){
    1.32 +  $ERROR('#2: eval("(function(){var x = 1;return\\u000Dx;var y=2;})()") does not lead to throwing exception');
    1.33 +}
    1.34 +
    1.35 +
    1.36 +
    1.37 +
    1.38 +//CHECK#3
    1.39 +try{
    1.40 +  if (eval("(function(){var x = 1;return\u2028x;var y=2;})()") !== undefined) {
    1.41 +    $ERROR("#1: LineTerminator(U-2028) between return and Identifier_opt yields return without Identifier_opt");    
    1.42 +  }
    1.43 +} catch(e){
    1.44 +  $ERROR('#3: eval("(function(){var x = 1;return\\u2028x;var y=2;})()") does not lead to throwing exception');
    1.45 +}
    1.46 +
    1.47 +
    1.48 +
    1.49 +
    1.50 +//CHECK#4
    1.51 +try{
    1.52 +  if (eval("(function(){var x =1;return\u2029x;var y=2;})()") !== undefined) {
    1.53 +    $ERROR("#1: LineTerminator(U-2029) between return and Identifier_opt yields return without Identifier_opt");    
    1.54 +  }
    1.55 +} catch(e){
    1.56 +  $ERROR('#4: eval("(function(){var x =1;return\\u2029x;var y=2;})()") does not lead to throwing exception');
    1.57 +}
    1.58 +

mercurial