S12.10_A1.1_T1.js (3528B)
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 info: | 6 The with statement adds a computed object to the front of the 7 scope chain of the current execution context 8 es5id: 12.10_A1.1_T1 9 description: Using "with" inside of global context leading to normal completion 10 flags: [noStrict] 11 ---*/ 12 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"; 41 42 with(myObj){ 43 st_p1 = p1; 44 st_p2 = p2; 45 st_p3 = p3; 46 st_parseInt = parseInt; 47 st_NaN = NaN; 48 st_Infinity = Infinity; 49 st_eval = eval; 50 st_parseFloat = parseFloat; 51 st_isNaN = isNaN; 52 st_isFinite = isFinite; 53 p1 = 'x1'; 54 this.p2 = 'x2'; 55 del = delete p3; 56 var p4 = 'x4'; 57 p5 = 'x5'; 58 var value = 'value'; 59 } 60 61 if(!(p1 === 1)){ 62 throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); 63 } 64 65 if(!(p2 === "x2")){ 66 throw new Test262Error('#2: p2 === "x2". Actual: p2 ==='+ p2 ); 67 } 68 69 if(!(p3 === 3)){ 70 throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); 71 } 72 73 if(!(p4 === "x4")){ 74 throw new Test262Error('#4: p4 === "x4". Actual: p4 ==='+ p4 ); 75 } 76 77 if(!(p5 === "x5")){ 78 throw new Test262Error('#5: p5 === "x5". Actual: p5 ==='+ p5 ); 79 } 80 81 if(!(myObj.p1 === "x1")){ 82 throw new Test262Error('#6: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); 83 } 84 85 if(!(myObj.p2 === "b")){ 86 throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); 87 } 88 89 if(!(myObj.p3 === undefined)){ 90 throw new Test262Error('#8: myObj.p3 === undefined. Actual: myObj.p3 ==='+ myObj.p3 ); 91 } 92 93 if(!(myObj.p4 === undefined)){ 94 throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); 95 } 96 97 if(!(myObj.p5 === undefined)){ 98 throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); 99 } 100 101 if(!(st_parseInt !== parseInt)){ 102 throw new Test262Error('#11: myObj.parseInt !== parseInt'); 103 } 104 105 if(!(st_NaN === "obj_NaN")){ 106 throw new Test262Error('#12: myObj.NaN !== NaN'); 107 } 108 109 if(!(st_Infinity !== Infinity)){ 110 throw new Test262Error('#13: myObj.Infinity !== Infinity'); 111 } 112 113 if(!(st_eval !== eval)){ 114 throw new Test262Error('#14: myObj.eval !== eval'); 115 } 116 117 if(!(st_parseFloat !== parseFloat)){ 118 throw new Test262Error('#15: myObj.parseFloat !== parseFloat'); 119 } 120 121 if(!(st_isNaN !== isNaN)){ 122 throw new Test262Error('#16: myObj.isNaN !== isNaN'); 123 } 124 125 if(!(st_isFinite !== isFinite)){ 126 throw new Test262Error('#17: myObj.isFinite !== isFinite'); 127 } 128 129 if(!(value === undefined)){ 130 throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); 131 } 132 133 if(!(myObj.value === "value")){ 134 throw new Test262Error('#19: myObj.value === "value". Actual: myObj.value ==='+ myObj.value ); 135 } 136 137 reportCompare(0, 0);