argument-not-coercible.js (1182B)
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 result be the empty String. 11 2. For each element next of codePoints, do 12 a. Let nextCP be ? ToNumber(next). 13 b. If nextCP is not an integral Number, throw a RangeError exception. 14 c. If ℝ(nextCP) < 0 or ℝ(nextCP) > 0x10FFFF, throw a RangeError exception. 15 d. Set result to the string-concatenation of result and UTF16EncodeCodePoint(ℝ(nextCP)). 16 3. Assert: If codePoints is empty, then result is the empty String. 17 4. Return result. 18 features: [String.fromCodePoint] 19 ---*/ 20 21 var obj = {}; 22 Object.defineProperty(obj, 'item', { 23 get: function() { 24 throw new Test262Error(); 25 } 26 }); 27 28 assert.throws(Test262Error, function() { 29 String.fromCodePoint({ 30 valueOf: function() { 31 throw new Test262Error(); 32 } 33 }); 34 }); 35 36 assert.throws(Test262Error, function() { 37 String.fromCodePoint(42, { 38 valueOf: function() { 39 throw new Test262Error(); 40 } 41 }); 42 }); 43 44 reportCompare(0, 0);