| 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: The production x += y is the same as x = x + y |
| 6 |
es5id: 11.13.2_A4.4_T1.2 |
| 7 |
description: Type(x) and Type(y) vary between primitive number and Number object |
| 8 |
---*/ |
| 9 |
|
| 10 |
var x; |
| 11 |
|
| 12 |
//CHECK#1 |
| 13 |
x = 1; |
| 14 |
x += 1; |
| 15 |
if (x !== 2) { |
| 16 |
$ERROR('#1: x = 1; x += 1; x === 2. Actual: ' + (x)); |
| 17 |
} |
| 18 |
|
| 19 |
//CHECK#2 |
| 20 |
x = new Number(1); |
| 21 |
x += 1; |
| 22 |
if (x !== 2) { |
| 23 |
$ERROR('#2: x = new Number(1); x += 1; x === 2. Actual: ' + (x)); |
| 24 |
} |
| 25 |
|
| 26 |
//CHECK#3 |
| 27 |
x = 1; |
| 28 |
x += new Number(1); |
| 29 |
if (x !== 2) { |
| 30 |
$ERROR('#3: x = 1; x += new Number(1); x === 2. Actual: ' + (x)); |
| 31 |
} |
| 32 |
|
| 33 |
//CHECK#4 |
| 34 |
x = new Number(1); |
| 35 |
x += new Number(1); |
| 36 |
if (x !== 2) { |
| 37 |
$ERROR('#4: x = new Number(1); x += new Number(1); x === 2. Actual: ' + (x)); |
| 38 |
} |