mirror of
https://github.com/tc39/test262.git
synced 2025-07-29 17:04:31 +02:00
Removed extraneous comment, added roundingMode: 'trunc' to NumberFormat options when fractional digits are formatted to match behaviour of DurationFormat -- doesn't make a difference with these test values, but could with others
This commit is contained in:
parent
007b333af2
commit
b37947f3a4
@ -42,19 +42,19 @@ let dfOpts = {microseconds: "numeric"};
|
|||||||
|
|
||||||
let expectedList = [];
|
let expectedList = [];
|
||||||
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "second", unitDisplay: "short"}).format(d.seconds));
|
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "second", unitDisplay: "short"}).format(d.seconds));
|
||||||
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "millisecond", unitDisplay: "short", minimumFractionDigits:0, maximumFractionDigits: 9}).format(d.milliseconds.toString() + decimalSeparator + d.microseconds.toString().padStart(3, '0') + d.nanoseconds.toString().padStart(3, '0')));
|
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "millisecond", unitDisplay: "short", minimumFractionDigits:0, maximumFractionDigits: 9, roundingMode: "trunc"}).format(d.milliseconds.toString() + decimalSeparator + d.microseconds.toString().padStart(3, '0') + d.nanoseconds.toString().padStart(3, '0')));
|
||||||
|
|
||||||
let expected = new Intl.ListFormat(locale, {style: "short"}).format(expectedList);
|
let expected = new Intl.ListFormat(locale, {style: "short"}).format(expectedList);
|
||||||
let actual = new Intl.DurationFormat(locale, dfOpts).format(d);
|
let actual = new Intl.DurationFormat(locale, dfOpts).format(d);
|
||||||
|
|
||||||
// assert.sameValue(actual, expected, `DurationFormat output when microseconds first "numeric" unit`);
|
assert.sameValue(actual, expected, `DurationFormat output when microseconds first "numeric" unit`);
|
||||||
|
|
||||||
dfOpts = {nanoseconds: "numeric"};
|
dfOpts = {nanoseconds: "numeric"};
|
||||||
expectedList = [];
|
expectedList = [];
|
||||||
|
|
||||||
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "second", unitDisplay: "short"}).format(d.seconds));
|
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "second", unitDisplay: "short"}).format(d.seconds));
|
||||||
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "millisecond", unitDisplay: "short"}).format(d.milliseconds));
|
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "millisecond", unitDisplay: "short"}).format(d.milliseconds));
|
||||||
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "microsecond", unitDisplay: "short", minimumFractionDigits:0, maximumFractionDigits: 9}).format(d.microseconds.toString() + decimalSeparator + d.nanoseconds.toString().padStart(3, '0')));
|
expectedList.push(new Intl.NumberFormat(locale, {style: "unit", unit: "microsecond", unitDisplay: "short", minimumFractionDigits:0, maximumFractionDigits: 9, roundingMode: "trunc"}).format(d.microseconds.toString() + decimalSeparator + d.nanoseconds.toString().padStart(3, '0')));
|
||||||
|
|
||||||
expected = new Intl.ListFormat(locale, {style: "short"}).format(expectedList);
|
expected = new Intl.ListFormat(locale, {style: "short"}).format(expectedList);
|
||||||
actual = new Intl.DurationFormat(locale, dfOpts).format(d);
|
actual = new Intl.DurationFormat(locale, dfOpts).format(d);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user