| 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 |
Returns the String value with the code unit for the given coerced types. |
| 7 |
info: | |
| 8 |
String.fromCodePoint ( ...codePoints ) |
| 9 |
|
| 10 |
1. Let codePoints be a List containing the arguments passed to this function. |
| 11 |
... |
| 12 |
5. Repeat while nextIndex < length |
| 13 |
a. Let next be codePoints[nextIndex]. |
| 14 |
b. Let nextCP be ToNumber(next). |
| 15 |
... |
| 16 |
6. Return the String value whose elements are, in order, the elements in the |
| 17 |
List elements. If length is 0, the empty string is returned. |
| 18 |
|
| 19 |
Ref: 7.1.3 ToNumber ( argument ) |
| 20 |
---*/ |
| 21 |
|
| 22 |
assert.sameValue(String.fromCodePoint(null), '\x00'); |
| 23 |
assert.sameValue(String.fromCodePoint(false), '\x00'); |
| 24 |
assert.sameValue(String.fromCodePoint(true), '\x01'); |
| 25 |
assert.sameValue(String.fromCodePoint('42'), '\x2A'); |
| 26 |
assert.sameValue(String.fromCodePoint('042'), '\x2A'); |
| 27 |
assert.sameValue( |
| 28 |
String.fromCodePoint({ |
| 29 |
valueOf: function() { |
| 30 |
return 31; |
| 31 |
} |
| 32 |
}), |
| 33 |
'\x1F' |
| 34 |
); |