Skip to content
Snippets Groups Projects
Commit 4bc96880 authored by André Bargull's avatar André Bargull Committed by Rick Waldron
Browse files

Add missing explicit ToString conversion for symbol values and ensure the...

Add missing explicit ToString conversion for symbol values and ensure the expected NaN result is a (locale-dependent) string
parent 3febd4c5
No related branches found
No related tags found
No related merge requests found
......@@ -7,11 +7,17 @@ description: >
Tests that the default value for the argument of
Intl.NumberFormat.prototype.format (value) is undefined.
info: |
11.1.4Number Format Functions
11.1.4 Number Format Functions
3. If value is not provided, let value be undefined.
4. Let x be ? ToNumber(value).
---*/
const nf = new Intl.NumberFormat();
assert.sameValue(nf.format(), NaN);
assert.sameValue(nf.format(undefined), NaN);
// In most locales this is string "NaN", but there are exceptions, cf. "ليس رقم"
// in Arabic, "epäluku" in Finnish, "не число" in Russian, "son emas" in Uzbek etc.
const resultNaN = nf.format(NaN);
assert.sameValue(nf.format(), resultNaN);
assert.sameValue(nf.format(undefined), resultNaN);
......@@ -16,6 +16,6 @@ invalidTargets.forEach(target => {
assert.throws(
TypeError,
() => fn.call(target),
`Calling format getter on ${target} should throw a TypeError.`
`Calling format getter on ${String(target)} should throw a TypeError.`
);
});
......@@ -16,6 +16,6 @@ invalidTargets.forEach(target => {
assert.throws(
TypeError,
() => fn.call(target),
`Calling formatToParts on ${target} should throw a TypeError.`
`Calling formatToParts on ${String(target)} should throw a TypeError.`
);
});
......@@ -16,6 +16,6 @@ invalidTargets.forEach(target => {
assert.throws(
TypeError,
() => fn.call(target),
`Calling resolvedOptions on ${target} should throw a TypeError.`
`Calling resolvedOptions on ${String(target)} should throw a TypeError.`
);
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment