From cbfa2c5f0043b8f14cc457363f2afcaa5e85f1ee Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Wed, 19 Sep 2018 13:01:58 +0530 Subject: [PATCH] intl: increase coverage for NumberFormat Increase coverage for Intl.NumberFormat by adding a test for format checking it's default value. --- .../prototype/format/default-value.js | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 test/intl402/NumberFormat/prototype/format/default-value.js diff --git a/test/intl402/NumberFormat/prototype/format/default-value.js b/test/intl402/NumberFormat/prototype/format/default-value.js new file mode 100644 index 0000000000..883722fec9 --- /dev/null +++ b/test/intl402/NumberFormat/prototype/format/default-value.js @@ -0,0 +1,43 @@ +// Copyright (C) 2018 Ujjwal Sharma. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-number-format-functions +description: > + Tests that the default value for the argument of + Intl.NumberFormat.prototype.format (value) is undefined. +info: | + 11.1.4Number Format Functions + + 3. If value is not provided, let value be undefined. +---*/ + +const localesList = [ + undefined, + ['de'], + ['th-u-nu-thai'], + ['en'], + ['ja-u-nu-jpanfin'], + ['ar-u-nu-arab'] +]; +const optionsList = [ + undefined, + { style: 'percent' }, + { style: 'currency', currency: 'EUR', currencyDisplay: 'symbol' }, + { style: 'currency', currency: 'IQD', currencyDisplay: 'symbol' }, + { style: 'currency', currency: 'KMF', currencyDisplay: 'symbol' }, + { style: 'currency', currency: 'CLF', currencyDisplay: 'symbol' }, + { + useGrouping: false, + minimumIntegerDigits: 3, + minimumFractionDigits: 1, + maximumFractionDigits: 3 + } +]; + +localesList.forEach(locales => { + optionsList.forEach(options => { + const nf = Intl.NumberFormat(locales, options); + assert.sameValue(nf.format(), nf.format(undefined)); + }); +});