mirror of https://github.com/tc39/test262.git
Add missing explicit ToString conversion for symbol values and ensure the expected NaN result is a (locale-dependent) string
This commit is contained in:
parent
3febd4c536
commit
4bc96880a1
|
@ -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.`
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue