Debian Codegraph @

js/src/tests/test262/built-ins/parseFloat/S15.1.2.3_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-parsefloat-string
6 description: >
7 Leading U+180E is not recognized as whitespace
8 info: |
9 18.2.4 parseFloat (string)
10
11 ...
12 3. Let trimmedString be a substring of inputString consisting of the
13 leftmost code unit that is not a StrWhiteSpaceChar and all code units
14 to the right of that code unit. (In other words, remove leading white
15 space.) If inputString does not contain any such code units, let
16 trimmedString be the empty string.
17 4. If neither trimmedString nor any prefix of trimmedString satisfies the
18 syntax of a StrDecimalLiteral (see 7.1.3.1), return NaN.
19 ...
20 features: [u180e]
21 ---*/
22
23 var mongolianVowelSeparator = "\u180E";
24
25 assert.sameValue(parseFloat(mongolianVowelSeparator + "1.1"), NaN, "Single leading U+180E");
26 assert.sameValue(parseFloat(mongolianVowelSeparator + mongolianVowelSeparator + mongolianVowelSeparator + "1.1"), NaN, "Multiple leading U+180E");
27 assert.sameValue(parseFloat(mongolianVowelSeparator), NaN, "Only U+180E");
28
29 reportCompare(0, 0);