-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unreachable code under --harmony-intl-number-format-v3
ICU 71 added new enum value UNUM_APPROXIMATELY_SIGN_FIELD need to map to "approximatelySign" We also discover a spec bug in tc39/proposal-intl-numberformat-v3#99 All the parts of formatRangeToParts should have a source "shared" for the case that start and end are the same or very close. Bug: chromium:1336865 Change-Id: I89142479989d3d2017d8cb89194db737710c38ed Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3717278 Reviewed-by: Shu-yu Guo <[email protected]> Commit-Queue: Frank Tang <[email protected]> Cr-Commit-Position: refs/heads/main@{#81286}
- Loading branch information
1 parent
afb2662
commit ba6db33
Showing
4 changed files
with
153 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright 2022 the V8 project authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
// Flags: --harmony-intl-number-format-v3 | ||
|
||
let nf = new Intl.NumberFormat(); | ||
let actual1 = nf.formatRangeToParts(1, 1); | ||
/* | ||
[{type: "approximatelySign", value: "~", source: "shared"}, | ||
{type: "integer", value: "1", source: "shared"}] | ||
*/ | ||
assertEquals(2, actual1.length); | ||
assertEquals("approximatelySign", actual1[0].type); | ||
assertEquals("~", actual1[0].value); | ||
assertEquals("shared", actual1[0].source); | ||
assertEquals("integer", actual1[1].type); | ||
assertEquals("1", actual1[1].value); | ||
assertEquals("shared", actual1[1].source); | ||
/* | ||
[{type: "approximatelySign", value: "~", source: "shared"}, | ||
{type: "integer", value: "9", source: "shared"}, | ||
{type: "group", value: ",", source: "shared"}, | ||
{type: "integer", value: "223", source: "shared"}, | ||
{type: "group", value: ",", source: "shared"}, | ||
{type: "integer", value: "372", source: "shared"}, | ||
{type: "group", value: ",", source: "shared"}, | ||
{type: "integer", value: "036", source: "shared"}, | ||
{type: "group", value: ",", source: "shared"}, | ||
{type: "integer", value: "854", source: "shared"}, | ||
{type: "group", value: ",", source: "shared"}, | ||
{type: "integer", value: "775", source: "shared"}, | ||
{type: "group", value: ",, source: "shared""}, | ||
{type: "integer", value: "807", source: "shared"}] | ||
*/ | ||
let bigint = 12345678901234567890n; | ||
let actual2 = nf.formatRangeToParts(bigint, bigint); | ||
assertEquals(14, actual2.length); | ||
assertEquals("approximatelySign", actual2[0].type); | ||
assertEquals("~", actual2[0].value); | ||
assertEquals("shared", actual2[0].source); | ||
assertEquals("integer", actual2[1].type); | ||
assertEquals("12", actual2[1].value); | ||
assertEquals("shared", actual2[1].source); | ||
assertEquals("group", actual2[2].type); | ||
assertEquals(",", actual2[2].value); | ||
assertEquals("shared", actual2[2].source); | ||
assertEquals("integer", actual2[3].type); | ||
assertEquals("345", actual2[3].value); | ||
assertEquals("shared", actual2[3].source); | ||
assertEquals("group", actual2[4].type); | ||
assertEquals(",", actual2[4].value); | ||
assertEquals("shared", actual2[4].source); | ||
assertEquals("integer", actual2[5].type); | ||
assertEquals("678", actual2[5].value); | ||
assertEquals("shared", actual2[5].source); | ||
assertEquals("group", actual2[6].type); | ||
assertEquals(",", actual2[6].value); | ||
assertEquals("shared", actual2[6].source); | ||
assertEquals("integer", actual2[7].type); | ||
assertEquals("901", actual2[7].value); | ||
assertEquals("shared", actual2[7].source); | ||
assertEquals("group", actual2[8].type); | ||
assertEquals(",", actual2[8].value); | ||
assertEquals("shared", actual2[8].source); | ||
assertEquals("integer", actual2[9].type); | ||
assertEquals("234", actual2[9].value); | ||
assertEquals("shared", actual2[9].source); | ||
assertEquals("group", actual2[10].type); | ||
assertEquals(",", actual2[10].value); | ||
assertEquals("shared", actual2[10].source); | ||
assertEquals("integer", actual2[11].type); | ||
assertEquals("567", actual2[11].value); | ||
assertEquals("shared", actual2[11].source); | ||
assertEquals("group", actual2[12].type); | ||
assertEquals(",", actual2[12].value); | ||
assertEquals("shared", actual2[12].source); | ||
assertEquals("integer", actual2[13].type); | ||
assertEquals("890", actual2[13].value); | ||
assertEquals("shared", actual2[13].source); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters