mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 04:54:44 +02:00
Intl.NumberFormat: cannot use assert.sameValue to compare object references.
This commit is contained in:
parent
bba2429cad
commit
0ead0130ea
@ -8,7 +8,13 @@ description: >
|
||||
values for its arguments (locales and options).
|
||||
---*/
|
||||
|
||||
const actual = new Intl.NumberFormat();
|
||||
const expected = new Intl.NumberFormat([], { __proto__: null });
|
||||
const actual = new Intl.NumberFormat().resolvedOptions();
|
||||
const expected = new Intl.NumberFormat([], { __proto__: null }).resolvedOptions();
|
||||
|
||||
assert.sameValue(actual.resolvedOptions(), expected.resolvedOptions());
|
||||
assert.sameValue(actual.locale, expected.locale);
|
||||
assert.sameValue(actual.minimumIntegerDigits, expected.minimumIntegerDigits);
|
||||
assert.sameValue(actual.minimumFractionDigits, expected.minimumFractionDigits);
|
||||
assert.sameValue(actual.maximumFractionDigits, expected.maximumFractionDigits);
|
||||
assert.sameValue(actual.numberingSystem, expected.numberingSystem);
|
||||
assert.sameValue(actual.style, expected.style);
|
||||
assert.sameValue(actual.useGrouping, expected.useGrouping);
|
||||
|
@ -22,10 +22,16 @@ const toObjectResults = [
|
||||
// Test if ToObject is used to convert primitives to Objects.
|
||||
toObjectResults.forEach(pair => {
|
||||
const [value, result] = pair;
|
||||
assert.sameValue(
|
||||
new Intl.NumberFormat(value).resolvedOptions(),
|
||||
new Intl.NumberFormat(result).resolvedOptions()
|
||||
);
|
||||
const actual = new Intl.NumberFormat(value).resolvedOptions();
|
||||
const expected = new Intl.NumberFormat(result).resolvedOptions()
|
||||
|
||||
assert.sameValue(actual.locale, expected.locale);
|
||||
assert.sameValue(actual.minimumIntegerDigits, expected.minimumIntegerDigits);
|
||||
assert.sameValue(actual.minimumFractionDigits, expected.minimumFractionDigits);
|
||||
assert.sameValue(actual.maximumFractionDigits, expected.maximumFractionDigits);
|
||||
assert.sameValue(actual.numberingSystem, expected.numberingSystem);
|
||||
assert.sameValue(actual.style, expected.style);
|
||||
assert.sameValue(actual.useGrouping, expected.useGrouping);
|
||||
});
|
||||
|
||||
// ToObject throws a TypeError for undefined and null, but it's not called
|
||||
|
@ -23,10 +23,16 @@ const toObjectResults = [
|
||||
// Test if ToObject is used to convert primitives to Objects.
|
||||
toObjectResults.forEach(pair => {
|
||||
const [value, result] = pair;
|
||||
assert.sameValue(
|
||||
new Intl.NumberFormat(['en-US'], value).resolvedOptions(),
|
||||
new Intl.NumberFormat(['en-US'], result).resolvedOptions()
|
||||
);
|
||||
const actual = new Intl.NumberFormat(['en-US'], value).resolvedOptions();
|
||||
const expected = new Intl.NumberFormat(['en-US'], result).resolvedOptions();
|
||||
assert.sameValue(actual.locale, expected.locale);
|
||||
assert.sameValue(actual.minimumIntegerDigits, expected.minimumIntegerDigits);
|
||||
assert.sameValue(actual.minimumFractionDigits, expected.minimumFractionDigits);
|
||||
assert.sameValue(actual.maximumFractionDigits, expected.maximumFractionDigits);
|
||||
assert.sameValue(actual.numberingSystem, expected.numberingSystem);
|
||||
assert.sameValue(actual.style, expected.style);
|
||||
assert.sameValue(actual.useGrouping, expected.useGrouping);
|
||||
|
||||
});
|
||||
|
||||
// ToObject throws a TypeError for undefined and null, but it's not called
|
||||
|
Loading…
x
Reference in New Issue
Block a user