Wed, 31 Dec 2014 13:27:57 +0100
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.11_T2.js
9 * @description Calling a function within "with" statement declared without the statement, leading to normal completion by "return"
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 var f = function(){
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 return value;
60 }
62 with(myObj){
63 result = f();
64 }
66 if(!(result === "value")){
67 $ERROR('#0: result === "value". Actual: result ==='+ result );
68 }
70 if(!(p1 === "x1")){
71 $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 );
72 }
74 if(!(p2 === "x2")){
75 $ERROR('#2: p2 === "x2". Actual: p2 ==='+ p2 );
76 }
78 try{
79 p3;
80 $ERROR('#3: p3 is nod defined');
81 }
82 catch(e){
83 }
85 try {
86 p4;
87 $ERROR('#4: p4 is not defined');
88 } catch(e) {
89 }
91 if(!(p5 === "x5")){
92 $ERROR('#5: p5 === "x5". Actual: p5 ==='+ p5 );
93 }
95 if(!(myObj.p1 === "a")){
96 $ERROR('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
97 }
99 if(!(myObj.p2 === "b")){
100 $ERROR('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 );
101 }
103 if(!(myObj.p3 === "c")){
104 $ERROR('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 );
105 }
107 if(!(myObj.p4 === undefined)){
108 $ERROR('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 );
109 }
111 if(!(myObj.p5 === undefined)){
112 $ERROR('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 );
113 }
115 if(!(st_parseInt === parseInt)){
116 $ERROR('#11: st_parseInt === parseInt. Actual: st_parseInt ==='+ st_parseInt );
117 }
119 if(!isNaN(st_NaN)){
120 $ERROR('#12: st_NaN === NaN. Actual: st_NaN ==='+ st_NaN );
121 }
123 if(!(st_Infinity === Infinity)){
124 $ERROR('#13: st_Infinity === Infinity. Actual: st_Infinity ==='+ st_Infinity );
125 }
127 if(!(st_eval === eval)){
128 $ERROR('#14: st_eval === eval. Actual: st_eval ==='+ st_eval );
129 }
131 if(!(st_parseFloat === parseFloat)){
132 $ERROR('#15: st_parseFloat === parseFloat. Actual: st_parseFloat ==='+ st_parseFloat );
133 }
135 if(!(st_isNaN === isNaN)){
136 $ERROR('#16: st_isNaN === isNaN. Actual: st_isNaN ==='+ st_isNaN );
137 }
139 if(!(st_isFinite === isFinite)){
140 $ERROR('#17: st_isFinite === isFinite. Actual: st_isFinite ==='+ st_isFinite );
141 }
143 try {
144 value;
145 $ERROR('#18: value is not defined');
146 } catch(e) {
147 }
149 if(!(myObj.value === "myObj_value")){
150 $ERROR('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value );
151 }