Debian Codegraph @

js/src/tests/test262/built-ins/parseInt/S15.1.2.2_A2_T10_U180E.js

raw
1 // Copyright (C) 2016 André Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 esid: sec-parseint-string-radix
6 description: >
7 Leading U+180E is not recognized as whitespace
8 info: |
9 18.2.5 parseInt (string , radix)
10
11 ...
12 3. Let S be a newly created substring of inputString consisting of the
13 first code unit that is not a StrWhiteSpaceChar and all code units
14 following that code unit. (In other words, remove leading white
15 space.) If inputString does not contain any such code unit, let S
16 be the empty string
17 ...
18 13. If S contains a code unit that is not a radix-R digit, let Z be
19 the substring of S consisting of all code units before the first
20 such code unit; otherwise, let Z be S.
21 14. If Z is empty, return NaN.
22 ...
23 features: [u180e]
24 ---*/
25
26 var mongolianVowelSeparator = "\u180E";
27
28 assert.sameValue(parseInt(mongolianVowelSeparator + "1"), NaN, 'parseInt(mongolianVowelSeparator + "1") must return NaN');
29 assert.sameValue(parseInt(mongolianVowelSeparator + mongolianVowelSeparator + mongolianVowelSeparator + "1"), NaN, 'parseInt( mongolianVowelSeparator + mongolianVowelSeparator + mongolianVowelSeparator + "1" ) must return NaN');
30 assert.sameValue(parseInt(mongolianVowelSeparator), NaN, 'parseInt("\\"\\\\u180E\\"") must return NaN');
31
32 reportCompare(0, 0);