Skip to content
Snippets Groups Projects
Commit 0ead0130 authored by Rick Waldron's avatar Rick Waldron
Browse files

Intl.NumberFormat: cannot use assert.sameValue to compare object references.

parent bba2429c
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,13 @@ description: > ...@@ -8,7 +8,13 @@ description: >
values for its arguments (locales and options). values for its arguments (locales and options).
---*/ ---*/
const actual = new Intl.NumberFormat(); const actual = new Intl.NumberFormat().resolvedOptions();
const expected = new Intl.NumberFormat([], { __proto__: null }); 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 = [ ...@@ -22,10 +22,16 @@ const toObjectResults = [
// Test if ToObject is used to convert primitives to Objects. // Test if ToObject is used to convert primitives to Objects.
toObjectResults.forEach(pair => { toObjectResults.forEach(pair => {
const [value, result] = pair; const [value, result] = pair;
assert.sameValue( const actual = new Intl.NumberFormat(value).resolvedOptions();
new Intl.NumberFormat(value).resolvedOptions(), const expected = new Intl.NumberFormat(result).resolvedOptions()
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 // ToObject throws a TypeError for undefined and null, but it's not called
......
...@@ -23,10 +23,16 @@ const toObjectResults = [ ...@@ -23,10 +23,16 @@ const toObjectResults = [
// Test if ToObject is used to convert primitives to Objects. // Test if ToObject is used to convert primitives to Objects.
toObjectResults.forEach(pair => { toObjectResults.forEach(pair => {
const [value, result] = pair; const [value, result] = pair;
assert.sameValue( const actual = new Intl.NumberFormat(['en-US'], value).resolvedOptions();
new Intl.NumberFormat(['en-US'], value).resolvedOptions(), const expected = new Intl.NumberFormat(['en-US'], result).resolvedOptions();
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 // ToObject throws a TypeError for undefined and null, but it's not called
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment