|
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 * Operator x++ uses GetValue and PutValue |
|
6 * |
|
7 * @path ch11/11.3/11.3.1/S11.3.1_A2.1_T1.js |
|
8 * @description Type(x) is Reference and GetBase(x) is not null |
|
9 */ |
|
10 |
|
11 //CHECK#1 |
|
12 var x = 1; |
|
13 var y = x++; |
|
14 if (y !== 1) { |
|
15 $ERROR('#1: var x = 1; var y = x++; y === 1. Actual: ' + (y)); |
|
16 } else { |
|
17 if (x !== 1 + 1) { |
|
18 $ERROR('#1: var x = 1; var y = x++; x === 1 + 1. Actual: ' + (x)); |
|
19 } |
|
20 } |
|
21 |
|
22 //CHECK#2 |
|
23 this.x = 1; |
|
24 var y = this.x++; |
|
25 if (y !== 1) { |
|
26 $ERROR('#2: this.x = 1; var y = this.x++; y === 1. Actual: ' + (y)); |
|
27 } else { |
|
28 if (this.x !== 1 + 1) { |
|
29 $ERROR('#2: this.x = 1; var y = this.x++; this.x === 1 + 1. Actual: ' + (this.x)); |
|
30 } |
|
31 } |
|
32 |
|
33 //CHECK#3 |
|
34 var object = new Object(); |
|
35 object.prop = 1; |
|
36 var y = object.prop++; |
|
37 if (y !== 1) { |
|
38 $ERROR('#3: var object = new Object(); object.prop = 1; var y = object.prop++; y === 1. Actual: ' + (y)); |
|
39 } else { |
|
40 if (this.x !== 1 + 1) { |
|
41 $ERROR('#3: var object = new Object(); object.prop = 1; var y = object.prop++; object.prop === 1 + 1. Actual: ' + (object.prop)); |
|
42 } |
|
43 } |
|
44 |
|
45 |
|
46 |