Debian Codegraph @

js/src/tests/test262/language/expressions/prefix-decrement/S11.4.5_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.5_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 throw new Test262Error('#1: var x = 1; --x === 1 - 1. Actual: ' + (--x));
14 } else {
15 if (x !== 1 - 1) {
16 throw new Test262Error('#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 throw new Test262Error('#2: this.x = 1; --this.x === 1 - 1. Actual: ' + (--this.x));
24 } else {
25 if (this.x !== 1 - 1) {
26 throw new Test262Error('#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 throw new Test262Error('#3: var object = new Object(); object.prop = 1; --object.prop === 1 - 1. Actual: ' + (--object.prop));
35 } else {
36 if (this.x !== 1 - 1) {
37 throw new Test262Error('#3: var object = new Object(); object.prop = 1; --object.prop; object.prop === 1 - 1. Actual: ' + (object.prop));
38 }
39 }
40
41 reportCompare(0, 0);