From cdd91e28958b1f04c5bcc8b551c3546ba4d3007d Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma <usharma1998@gmail.com> Date: Thu, 20 Sep 2018 02:14:19 +0530 Subject: [PATCH] Improve ToNumber test for NumberFormat.format --- .../NumberFormat/prototype/format/value-tonumber.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/intl402/NumberFormat/prototype/format/value-tonumber.js b/test/intl402/NumberFormat/prototype/format/value-tonumber.js index d3dd8e0003..710955a684 100644 --- a/test/intl402/NumberFormat/prototype/format/value-tonumber.js +++ b/test/intl402/NumberFormat/prototype/format/value-tonumber.js @@ -25,11 +25,16 @@ const toNumberResults = [ const nf = new Intl.NumberFormat(); toNumberResults.forEach(pair => { - const value = pair[0]; - const result = pair[1]; + const [value, result] = pair; 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( TypeError, () => nf.format(Symbol()), -- GitLab