mirror of https://github.com/tc39/test262.git
Improve ToNumber test for NumberFormat.format
This commit is contained in:
parent
7a87bde265
commit
cdd91e2895
|
@ -25,11 +25,16 @@ const toNumberResults = [
|
||||||
const nf = new Intl.NumberFormat();
|
const nf = new Intl.NumberFormat();
|
||||||
|
|
||||||
toNumberResults.forEach(pair => {
|
toNumberResults.forEach(pair => {
|
||||||
const value = pair[0];
|
const [value, result] = pair;
|
||||||
const result = pair[1];
|
|
||||||
assert.sameValue(nf.format(value), nf.format(result));
|
assert.sameValue(nf.format(value), nf.format(result));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let count = 0;
|
||||||
|
const dummy = {};
|
||||||
|
dummy[Symbol.toPrimitive] = hint => (hint === 'number' ? ++count : NaN);
|
||||||
|
assert.sameValue(nf.format(dummy), nf.format(count));
|
||||||
|
assert.sameValue(count, 1);
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
TypeError,
|
TypeError,
|
||||||
() => nf.format(Symbol()),
|
() => nf.format(Symbol()),
|
||||||
|
|
Loading…
Reference in New Issue