summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/ch11/11.3/11.3.1/S11.3.1_A2.1_T1.js
blob: 3f32ea5b701c53a0a5631ab12dbe82bb5913570f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * Operator x++ uses GetValue and PutValue
 *
 * @path ch11/11.3/11.3.1/S11.3.1_A2.1_T1.js
 * @description Type(x) is Reference and GetBase(x) is not null
 */

//CHECK#1
var x = 1;
var y = x++;
if (y !== 1) {
  $ERROR('#1: var x = 1; var y = x++; y === 1. Actual: ' + (y));
} else {
  if (x !== 1 + 1) {
    $ERROR('#1: var x = 1; var y = x++; x === 1 + 1. Actual: ' + (x));
  } 
}

//CHECK#2
this.x = 1;
var y = this.x++; 
if (y !== 1) {
  $ERROR('#2: this.x = 1; var y = this.x++; y === 1. Actual: ' + (y));
} else {
  if (this.x !== 1 + 1) {
    $ERROR('#2: this.x = 1; var y = this.x++; this.x === 1 + 1. Actual: ' + (this.x));
  } 
}

//CHECK#3
var object = new Object();
object.prop = 1;
var y = object.prop++;
if (y !== 1) {
  $ERROR('#3: var object = new Object(); object.prop = 1; var y = object.prop++; y === 1. Actual: ' + (y));
} else {
  if (this.x !== 1 + 1) {
    $ERROR('#3: var object = new Object(); object.prop = 1; var y = object.prop++; object.prop === 1 + 1. Actual: ' + (object.prop));
  } 
}