5bd5fd74b5
1. Move the reading of Notation before calling SetNumberFormatDigitOptions() ( sync after https://github.com/tc39/proposal-unified-intl-numberformat/pull/37) 2. Sync SetNumberFormatDigitOptions to the spec. 3. Consider the case that while RoundingType is "compact-rounding" do not set the precision. 4. correct the tests accordingly. 5. Fix the rounding of notation: "compact" and put regression cases into test/intl/regress-9408.js Bug: v8:9408 Change-Id: I78d66601fe21b1a74a50047b2abe6a2838a58b8c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1681599 Commit-Queue: Frank Tang <ftang@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#62450}
71 lines
1.7 KiB
JavaScript
71 lines
1.7 KiB
JavaScript
// Copyright 2019 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-numberformat-unified
|
|
// Similar to constructor-order.js but also consider the new options
|
|
// in https://tc39-transfer.github.io/proposal-unified-intl-numberformat/
|
|
|
|
// Throws only once during construction.
|
|
// Check for all getters to prevent regression.
|
|
// Preserve the order of getter initialization.
|
|
let getCount = 0;
|
|
|
|
new Intl.NumberFormat(['en-US'], {
|
|
get localeMatcher() {
|
|
assertEquals(0, getCount++);
|
|
},
|
|
get style() {
|
|
assertEquals(1, getCount++);
|
|
},
|
|
get currency() {
|
|
assertEquals(2, getCount++);
|
|
},
|
|
get currencyDisplay() {
|
|
assertEquals(3, getCount++);
|
|
},
|
|
// Begin of new options
|
|
get currencySign() {
|
|
assertEquals(4, getCount++);
|
|
},
|
|
get unit() {
|
|
assertEquals(5, getCount++);
|
|
},
|
|
get unitDisplay() {
|
|
assertEquals(6, getCount++);
|
|
},
|
|
get notation() {
|
|
assertEquals(7, getCount++);
|
|
},
|
|
// End of new options
|
|
get minimumIntegerDigits() {
|
|
assertEquals(8, getCount++);
|
|
},
|
|
get minimumFractionDigits() {
|
|
assertEquals(9, getCount++);
|
|
},
|
|
get maximumFractionDigits() {
|
|
assertEquals(10, getCount++);
|
|
},
|
|
get minimumSignificantDigits() {
|
|
assertEquals(11, getCount++);
|
|
},
|
|
get maximumSignificantDigits() {
|
|
assertEquals(12, getCount++);
|
|
},
|
|
// Begin of new options
|
|
get compactDisplay() {
|
|
assertEquals(13, getCount++);
|
|
},
|
|
// End of new options
|
|
get useGrouping() {
|
|
assertEquals(14, getCount++);
|
|
},
|
|
// Begin of new options
|
|
get signDisplay() {
|
|
assertEquals(15, getCount++);
|
|
},
|
|
// End of new options
|
|
});
|
|
assertEquals(16, getCount);
|