Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/String/fromCodePoint/argument-not-coercible.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 es6id: 21.1.2.2
5 description: >
6 Return abrupt from ToNumber(next).
7 info: |
8 String.fromCodePoint ( ...codePoints )
9
10 1. Let codePoints be a List containing the arguments passed to this function.
11 2. Let length be the number of elements in codePoints.
12 3. Let elements be a new List.
13 4. Let nextIndex be 0.
14 5. Repeat while nextIndex < length
15 a. Let next be codePoints[nextIndex].
16 b. Let nextCP be ToNumber(next).
17 c. ReturnIfAbrupt(nextCP).
18 ---*/
19
20 var obj = {};
21 Object.defineProperty(obj, 'item', {
22 get: function() {
23 throw new Test262Error();
24 }
25 });
26
27 assert.throws(Test262Error, function() {
28 String.fromCodePoint({
29 valueOf: function() {
30 throw new Test262Error();
31 }
32 });
33 });
34
35 assert.throws(Test262Error, function() {
36 String.fromCodePoint(42, {
37 valueOf: function() {
38 throw new Test262Error();
39 }
40 });
41 });