dfab3f44e8
Change NumberFormat.prototpe.resolvedOptions to return new options in v3. Also fix a heap allocation assertion bug in GetStringOrBooleanOption while the useGrouping option is an invalid argument. https://github.com/tc39/proposal-intl-numberformat-v3 https://chromestatus.com/guide/edit/5707621009981440 Design Doc: https://docs.google.com/document/d/19jAogPBb6W4Samt8NWGZKu47iv0_KoQhBvLgQH3xvr8/edit Bug: v8:10776 Change-Id: Iaeeb0398b77394db3c941a2706d44b734a1f9d8c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3427298 Reviewed-by: Shu-yu Guo <syg@chromium.org> Commit-Queue: Frank Tang <ftang@chromium.org> Cr-Commit-Position: refs/heads/main@{#79161}
20 lines
846 B
JavaScript
20 lines
846 B
JavaScript
// Copyright 2021 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 defaultFmt = new Intl.NumberFormat("en",
|
|
{ minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
let autoFmt = new Intl.NumberFormat("en",
|
|
{ minimumFractionDigits: 2, maximumFractionDigits: 2,
|
|
trailingZeroDisplay: 'auto'});
|
|
let stripIfIntegerFmt = new Intl.NumberFormat("en",
|
|
{ minimumFractionDigits: 2, maximumFractionDigits: 2,
|
|
trailingZeroDisplay: 'stripIfInteger'});
|
|
|
|
assertEquals("auto", defaultFmt.resolvedOptions().trailingZeroDisplay);
|
|
assertEquals("auto", autoFmt.resolvedOptions().trailingZeroDisplay);
|
|
assertEquals("stripIfInteger",
|
|
stripIfIntegerFmt.resolvedOptions().trailingZeroDisplay);
|