Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/prefix-increment/S11.4.4_A2.1_T1.js

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