| 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: | |
| 6 |
ToNumber(first expression) is called first, and then ToNumber(second |
| 7 |
expression) |
| 8 |
es5id: 11.6.2_A2.3_T1 |
| 9 |
description: Checking with "throw" |
| 10 |
---*/ |
| 11 |
|
| 12 |
//CHECK#1 |
| 13 |
var x = { valueOf: function () { throw "x"; } }; |
| 14 |
var y = { valueOf: function () { throw "y"; } }; |
| 15 |
try { |
| 16 |
x - y; |
| 17 |
$ERROR('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x - y throw "x". Actual: ' + (x - y)); |
| 18 |
} catch (e) { |
| 19 |
if (e === "y") { |
| 20 |
$ERROR('#1.2: ToNumber(first expression) is called first, and then ToNumber(second expression)'); |
| 21 |
} else { |
| 22 |
if (e !== "x") { |
| 23 |
$ERROR('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x - y throw "x". Actual: ' + (e)); |
| 24 |
} |
| 25 |
} |
| 26 |
} |