js/src/tests/test262/ch12/12.10/S12.10_A1.5_T5.js

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 // Copyright 2009 the Sputnik authors.  All rights reserved.
     2 // This code is governed by the BSD license found in the LICENSE file.
     4 /**
     5  * The with statement adds a computed object to the front of the
     6  * scope chain of the current execution context
     7  *
     8  * @path ch12/12.10/S12.10_A1.5_T5.js
     9  * @description Using "with" statement within "for-in" statement, leading to completion by break
    10  * @noStrict
    11  */
    13 this.p1 = 1;
    14 this.p2 = 2;
    15 this.p3 = 3;
    16 var result = "result";
    17 var myObj = {p1: 'a', 
    18              p2: 'b', 
    19              p3: 'c',
    20              value: 'myObj_value',
    21              valueOf : function(){return 'obj_valueOf';},
    22              parseInt : function(){return 'obj_parseInt';},
    23              NaN : 'obj_NaN',
    24              Infinity : 'obj_Infinity',
    25              eval     : function(){return 'obj_eval';},
    26              parseFloat : function(){return 'obj_parseFloat';},
    27              isNaN      : function(){return 'obj_isNaN';},
    28              isFinite   : function(){return 'obj_isFinite';}
    29 }
    30 var del;
    31 var st_p1 = "p1";
    32 var st_p2 = "p2";
    33 var st_p3 = "p3";
    34 var st_parseInt = "parseInt";
    35 var st_NaN = "NaN";
    36 var st_Infinity = "Infinity";
    37 var st_eval = "eval";
    38 var st_parseFloat = "parseFloat";
    39 var st_isNaN = "isNaN";
    40 var st_isFinite = "isFinite";
    42 for(var prop in myObj){
    43   with(myObj){
    44     break;
    45     if(prop === 'p1') {
    46       st_p1 = p1;
    47       p1 = 'x1';
    48     }
    49     if(prop === 'p2') {
    50       st_p2 = p2;
    51       this.p2 = 'x2';
    52     }
    53     if(prop === 'p3') {
    54       st_p3 = p3;
    55       del = delete p3;
    56     }
    57     if(prop === 'parseInt') st_parseInt = parseInt;
    58     if(prop === 'NaN') st_NaN = NaN;
    59     if(prop === 'Infinity') st_Infinity = Infinity;
    60     if(prop === 'eval') st_eval = eval;
    61     if(prop === 'parseFloat') st_parseFloat = parseFloat;
    62     if(prop === 'isNaN') st_isNaN = isNaN;
    63     if(prop === 'isFinite') st_isFinite = isFinite;
    64     var p4 = 'x4';
    65     p5 = 'x5';
    66     var value = 'value';
    67   }
    68 }
    70 if(!(p1 === 1)){
    71   $ERROR('#1: p1 === 1. Actual:  p1 ==='+ p1  );
    72 }
    74 if(!(p2 === 2)){
    75   $ERROR('#2: p2 === 2. Actual:  p2 ==='+ p2  );
    76 }
    78 if(!(p3 === 3)){
    79   $ERROR('#3: p3 === 3. Actual:  p3 ==='+ p3  );
    80 }
    82 if(!(p4 === undefined)){
    83   $ERROR('#4: p4 === undefined. Actual:  p4 ==='+ p4  );
    84 }
    86 try {
    87   p5;
    88   $ERROR('#5: p5 is not defined');
    89 } catch(e) {    
    90 }
    92 if(!(myObj.p1 === "a")){
    93   $ERROR('#6: myObj.p1 === "a". Actual:  myObj.p1 ==='+ myObj.p1  );
    94 }
    96 if(!(myObj.p2 === "b")){
    97   $ERROR('#7: myObj.p2 === "b". Actual:  myObj.p2 ==='+ myObj.p2  );
    98 }
   100 if(!(myObj.p3 === "c")){
   101   $ERROR('#8: myObj.p3 === "c". Actual:  myObj.p3 ==='+ myObj.p3  );
   102 }
   104 if(!(myObj.p4 === undefined)){
   105   $ERROR('#9: myObj.p4 === undefined. Actual:  myObj.p4 ==='+ myObj.p4  );
   106 }
   108 if(!(myObj.p5 === undefined)){
   109   $ERROR('#10: myObj.p5 === undefined. Actual:  myObj.p5 ==='+ myObj.p5  );
   110 }
   112 if(!(st_parseInt === "parseInt")){
   113   $ERROR('#11: myObj.parseInt === "parseInt". Actual:  myObj.parseInt ==='+ myObj.parseInt  );
   114 }
   116 if(!(st_NaN === "NaN")){
   117   $ERROR('#12: st_NaN === "NaN". Actual:  st_NaN ==='+ st_NaN  );
   118 }
   120 if(!(st_Infinity === "Infinity")){
   121   $ERROR('#13: st_Infinity === "Infinity". Actual:  st_Infinity ==='+ st_Infinity  );
   122 }
   124 if(!(st_eval === "eval")){
   125   $ERROR('#14: st_eval === "eval". Actual:  st_eval ==='+ st_eval  );
   126 }
   128 if(!(st_parseFloat === "parseFloat")){
   129   $ERROR('#15: st_parseFloat === "parseFloat". Actual:  st_parseFloat ==='+ st_parseFloat  );
   130 }
   132 if(!(st_isNaN === "isNaN")){
   133   $ERROR('#16: st_isNaN === "isNaN". Actual:  st_isNaN ==='+ st_isNaN  );
   134 }
   136 if(!(st_isFinite === "isFinite")){
   137   $ERROR('#17: st_isFinite === "isFinite". Actual:  st_isFinite ==='+ st_isFinite  );
   138 }
   140 if(!(value === undefined)){
   141   $ERROR('#18: value === undefined. Actual:  value ==='+ value  );
   142 }
   144 if(!(myObj.value === "myObj_value")){
   145   $ERROR('#19: myObj.value === "myObj_value". Actual:  myObj.value ==='+ myObj.value  );
   146 }

mercurial