summaryrefslogtreecommitdiff
path: root/test/built-ins/parseInt/S15.1.2.2_A2_T10_U180E.js
blob: ec0b7d90ca91f3428251efbd656d385eac98c6c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (C) 2016 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es5id: 15.1.2.2
es6id: 18.2.5
esid: sec-parseint-string-radix
description: >
  Leading U+180E is not recognized as whitespace
info: >
  18.2.5 parseInt (string , radix)

  ...
  3. Let S be a newly created substring of inputString consisting of the
     first code unit that is not a StrWhiteSpaceChar and all code units
     following that code unit. (In other words, remove leading white
     space.) If inputString does not contain any such code unit, let S
     be the empty string
  ...
  13. If S contains a code unit that is not a radix-R digit, let Z be
      the substring of S consisting of all code units before the first
      such code unit; otherwise, let Z be S.
  14. If Z is empty, return NaN.
  ...
features: [u180e]
---*/

var mongolianVowelSeparator = "\u180E";

assert.sameValue(parseInt(mongolianVowelSeparator + "1"), NaN, "Single leading U+180E");
assert.sameValue(parseInt(mongolianVowelSeparator + mongolianVowelSeparator + mongolianVowelSeparator + "1"), NaN, "Multiple leading U+180E");
assert.sameValue(parseInt(mongolianVowelSeparator), NaN, "Only U+180E");