tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S11.3.1_A2.1_T1.js (1249B)


      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.3.1_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 var y = x++;
     13 if (y !== 1) {
     14  throw new Test262Error('#1: var x = 1; var y = x++; y === 1. Actual: ' + (y));
     15 } else {
     16  if (x !== 1 + 1) {
     17    throw new Test262Error('#1: var x = 1; var y = x++; x === 1 + 1. Actual: ' + (x));
     18  } 
     19 }
     20 
     21 //CHECK#2
     22 this.x = 1;
     23 var y = this.x++; 
     24 if (y !== 1) {
     25  throw new Test262Error('#2: this.x = 1; var y = this.x++; y === 1. Actual: ' + (y));
     26 } else {
     27  if (this.x !== 1 + 1) {
     28    throw new Test262Error('#2: this.x = 1; var y = this.x++; this.x === 1 + 1. Actual: ' + (this.x));
     29  } 
     30 }
     31 
     32 //CHECK#3
     33 var object = new Object();
     34 object.prop = 1;
     35 var y = object.prop++;
     36 if (y !== 1) {
     37  throw new Test262Error('#3: var object = new Object(); object.prop = 1; var y = object.prop++; y === 1. Actual: ' + (y));
     38 } else {
     39  if (this.x !== 1 + 1) {
     40    throw new Test262Error('#3: var object = new Object(); object.prop = 1; var y = object.prop++; object.prop === 1 + 1. Actual: ' + (object.prop));
     41  } 
     42 }
     43 
     44 reportCompare(0, 0);