Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/isFinite/toprimitive-call-abrupt.js

raw
1 // Copyright (C) 2016 The V8 Project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 es6id: 18.2.2
6 esid: sec-isfinite-number
7 description: >
8 Return abrupt completion calling number.@@toPrimitive
9 info: |
10 isFinite (number)
11
12 1. Let num be ? ToNumber(number).
13
14 ToPrimitive ( input [ , PreferredType ] )
15
16 [...]
17 4. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
18 5. If exoticToPrim is not undefined, then
19 a. Let result be ? Call(exoticToPrim, input, « hint »).
20 features: [Symbol.toPrimitive]
21 ---*/
22
23 var obj = {};
24 obj[Symbol.toPrimitive] = function() {
25 throw new Test262Error();
26 };
27
28 assert.throws(Test262Error, function() {
29 isFinite(obj);
30 });