|
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 * Using arguments object within a "with" Expression that is nested in a function is admitted |
|
6 * |
|
7 * @path ch13/13.2/S13.2.2_A18_T2.js |
|
8 * @description Object is declared with "__obj={callee:"a"}" |
|
9 */ |
|
10 |
|
11 this.callee = 0; |
|
12 var b; |
|
13 |
|
14 __obj={callee:"a"}; |
|
15 |
|
16 function f(){ |
|
17 with (arguments){ |
|
18 callee=1; |
|
19 b=true; |
|
20 return arguments; |
|
21 } |
|
22 }; |
|
23 |
|
24 result=f(__obj); |
|
25 |
|
26 ////////////////////////////////////////////////////////////////////////////// |
|
27 //CHECK#1 |
|
28 if (callee !== 0) { |
|
29 $ERROR('#1: callee === 0. Actual: callee ==='+callee); |
|
30 } |
|
31 // |
|
32 ////////////////////////////////////////////////////////////////////////////// |
|
33 |
|
34 ////////////////////////////////////////////////////////////////////////////// |
|
35 //CHECK#2 |
|
36 if (__obj.callee !== "a") { |
|
37 $ERROR('#2: __obj.callee === "a". Actual: __obj.callee ==='+__obj.callee); |
|
38 } |
|
39 // |
|
40 ////////////////////////////////////////////////////////////////////////////// |
|
41 |
|
42 ////////////////////////////////////////////////////////////////////////////// |
|
43 //CHECK#3 |
|
44 if (result.callee !== 1) { |
|
45 $ERROR('#3: result.callee === 1. Actual: result.callee ==='+result.callee); |
|
46 } |
|
47 // |
|
48 ////////////////////////////////////////////////////////////////////////////// |
|
49 |
|
50 ////////////////////////////////////////////////////////////////////////////// |
|
51 //CHECK#4 |
|
52 if (!(this.b)) { |
|
53 $ERROR('#4: this.b === true. Actual: this.b ==='+this.b); |
|
54 } |
|
55 // |
|
56 ////////////////////////////////////////////////////////////////////////////// |
|
57 |