~ubuntu-branches/ubuntu/vivid/mozjs24/vivid

« back to all changes in this revision

Viewing changes to js/src/tests/test262/ch12/12.10/S12.10_A3.4_T1.js

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2014-02-11 21:55:34 UTC
  • Revision ID: package-import@ubuntu.com-20140211215534-m1zyq5aj59md3y07
Tags: upstream-24.2.0
ImportĀ upstreamĀ versionĀ 24.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 * No matter how control leaves the embedded 'Statement',
 
6
 * the scope chain is always restored to its former state
 
7
 *
 
8
 * @path ch12/12.10/S12.10_A3.4_T1.js
 
9
 * @description Using "with" statement within iteration statement, leading to normal completion
 
10
 * @noStrict
 
11
 */
 
12
 
 
13
this.p1 = 1;
 
14
 
 
15
var result = "result";
 
16
 
 
17
var myObj = {
 
18
    p1: 'a', 
 
19
    value: 'myObj_value',
 
20
    valueOf : function(){return 'obj_valueOf';}
 
21
}
 
22
 
 
23
do {
 
24
    with(myObj){
 
25
        p1 = 'x1';
 
26
    }
 
27
} while(false);
 
28
 
 
29
//////////////////////////////////////////////////////////////////////////////
 
30
//CHECK#1
 
31
if(p1 !== 1){
 
32
  $ERROR('#1: p1 === 1. Actual:  p1 ==='+ p1  );
 
33
}
 
34
//
 
35
//////////////////////////////////////////////////////////////////////////////
 
36
 
 
37
//////////////////////////////////////////////////////////////////////////////
 
38
//CHECK#2
 
39
if(myObj.p1 !== "x1"){
 
40
  $ERROR('#2: myObj.p1 === "x1". Actual:  myObj.p1 ==='+ myObj.p1  );
 
41
}
 
42
//
 
43
//////////////////////////////////////////////////////////////////////////////
 
44
 
 
45
 
 
46