2011-09-07 08:35:18 +02:00
|
|
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
|
|
|
info: The production x -= y is the same as x = x - y
|
2014-07-25 00:41:42 +02:00
|
|
|
es5id: 11.13.2_A4.5_T2.1
|
2014-07-22 01:09:02 +02:00
|
|
|
description: >
|
|
|
|
Type(x) is different from Type(y) and both types vary between
|
|
|
|
Number (primitive or object) and Boolean (primitive and object)
|
|
|
|
---*/
|
2011-09-07 08:35:18 +02:00
|
|
|
|
2014-08-05 17:38:52 +02:00
|
|
|
var x;
|
|
|
|
|
2011-09-07 08:35:18 +02:00
|
|
|
//CHECK#1
|
|
|
|
x = true;
|
|
|
|
x -= 1;
|
|
|
|
if (x !== 0) {
|
2021-07-28 22:48:39 +02:00
|
|
|
throw new Test262Error('#1: x = true; x -= 1; x === 0. Actual: ' + (x));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//CHECK#2
|
|
|
|
x = 1;
|
|
|
|
x -= true;
|
|
|
|
if (x !== 0) {
|
2021-07-28 22:48:39 +02:00
|
|
|
throw new Test262Error('#2: x = 1; x -= true; x === 0. Actual: ' + (x));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//CHECK#3
|
|
|
|
x = new Boolean(true);
|
|
|
|
x -= 1;
|
|
|
|
if (x !== 0) {
|
2021-07-28 22:48:39 +02:00
|
|
|
throw new Test262Error('#3: x = new Boolean(true); x -= 1; x === 0. Actual: ' + (x));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//CHECK#4
|
|
|
|
x = 1;
|
|
|
|
x -= new Boolean(true);
|
|
|
|
if (x !== 0) {
|
2021-07-28 22:48:39 +02:00
|
|
|
throw new Test262Error('#4: x = 1; x -= new Boolean(true); x === 0. Actual: ' + (x));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//CHECK#5
|
|
|
|
x = true;
|
|
|
|
x -= new Number(1);
|
|
|
|
if (x !== 0) {
|
2021-07-28 22:48:39 +02:00
|
|
|
throw new Test262Error('#5: x = true; x -= new Number(1); x === 0. Actual: ' + (x));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//CHECK#6
|
|
|
|
x = new Number(1);
|
|
|
|
x -= true;
|
|
|
|
if (x !== 0) {
|
2021-07-28 22:48:39 +02:00
|
|
|
throw new Test262Error('#6: x = new Number(1); x -= true; x === 0. Actual: ' + (x));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//CHECK#7
|
|
|
|
x = new Boolean(true);
|
|
|
|
x -= new Number(1);
|
|
|
|
if (x !== 0) {
|
2021-07-28 22:48:39 +02:00
|
|
|
throw new Test262Error('#7: x = new Boolean(true); x -= new Number(1); x === 0. Actual: ' + (x));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//CHECK#8
|
|
|
|
x = new Number(1);
|
|
|
|
x -= new Boolean(true);
|
|
|
|
if (x !== 0) {
|
2021-07-28 22:48:39 +02:00
|
|
|
throw new Test262Error('#8: x = new Number(1); x -= new Boolean(true); x === 0. Actual: ' + (x));
|
2011-09-07 08:35:18 +02:00
|
|
|
}
|