argument-is-not-integer.js (1058B)
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 Throw a RangeError if an argument is not equal to its Integer representation. 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 ... 15 features: [String.fromCodePoint] 16 ---*/ 17 18 assert.throws(RangeError, function() { 19 String.fromCodePoint(3.14); 20 }); 21 22 assert.throws(RangeError, function() { 23 String.fromCodePoint(42, 3.14); 24 }); 25 26 assert.throws(RangeError, function() { 27 String.fromCodePoint('3.14'); 28 }); 29 30 // ToNumber(undefined) returns NaN. 31 assert.throws(RangeError, function() { 32 String.fromCodePoint(undefined); 33 }); 34 35 assert.throws(RangeError, function() { 36 String.fromCodePoint('_1'); 37 }); 38 39 assert.throws(RangeError, function() { 40 String.fromCodePoint('1a'); 41 }); 42 43 reportCompare(0, 0);