number-is-out-of-range.js (930B)
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 < 0 or > 0x10FFFF. 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 ... 16 features: [String.fromCodePoint] 17 ---*/ 18 19 assert.throws(RangeError, function() { 20 String.fromCodePoint(-1); 21 }); 22 23 assert.throws(RangeError, function() { 24 String.fromCodePoint(1, -1); 25 }); 26 27 assert.throws(RangeError, function() { 28 String.fromCodePoint(1114112); 29 }); 30 31 assert.throws(RangeError, function() { 32 String.fromCodePoint(Infinity); 33 }); 34 35 reportCompare(0, 0);