From dde0c1672f56d9e532d7af130595a048e4e4da56 Mon Sep 17 00:00:00 2001 From: Romulo Cintra Date: Wed, 23 Mar 2022 17:50:52 +0100 Subject: [PATCH 1/2] update nfv3 test for roundingIncrement --- .../constructor-roundingIncrement-invalid.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js b/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js index 1274a0daac7..ebc856b3b61 100644 --- a/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js +++ b/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js @@ -1,4 +1,5 @@ // Copyright 2021 the V8 project authors. All rights reserved. +// Copyright (C) 2022 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-initializenumberformat @@ -26,14 +27,22 @@ assert.throws(RangeError, function() { new Intl.NumberFormat([], {roundingIncrement: 5001}); }, '5001'); -assert.throws(RangeError, function() { +// InitializeNumberFormat ( numberFormat, locales, options ) (...) +// 23. If roundingIncrement is not 1 and numberFormat.[[RoundingType]] is not fractionDigits, throw a TypeError exception. +assert.throws(TypeError, function() { new Intl.NumberFormat([], {roundingIncrement: 2, roundingPriority: 'morePrecision'}); }, '2, roundingType is "morePrecision"'); -assert.throws(RangeError, function() { +assert.throws(TypeError, function() { new Intl.NumberFormat([], {roundingIncrement: 2, roundingPriority: 'lessPrecision'}); }, '2, roundingType is "lessPrecision"'); -assert.throws(RangeError, function() { +assert.throws(TypeError, function() { new Intl.NumberFormat([], {roundingIncrement: 2, minimumSignificantDigits: 1}); }, '2, roundingType is "significantDigits"'); + +// InitializeNumberFormat ( numberFormat, locales, options ) (...) +// 24. If roundingIncrement is not 1 and numberFormat.[[MaximumFractionDigits]] is not equal to numberFormat.[[MinimumFractionDigits]], throw a RangeError exception. +assert.throws(RangeError, function() { + new Intl.NumberFormat([], {roundingIncrement: 2, maximumFractionDigits:3 , minimumFractionDigits:2 }); +}, '"maximumFractionDigits" is not equal to "minimumFractionDigits"'); From 80566a814a93e4658a5699f8df9665d6774a1dbe Mon Sep 17 00:00:00 2001 From: Romulo Cintra Date: Thu, 31 Mar 2022 15:37:41 +0200 Subject: [PATCH 2/2] update roundingIncrement test --- .../NumberFormat/constructor-roundingIncrement-invalid.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js b/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js index ebc856b3b61..e92266498e4 100644 --- a/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js +++ b/test/intl402/NumberFormat/constructor-roundingIncrement-invalid.js @@ -27,8 +27,6 @@ assert.throws(RangeError, function() { new Intl.NumberFormat([], {roundingIncrement: 5001}); }, '5001'); -// InitializeNumberFormat ( numberFormat, locales, options ) (...) -// 23. If roundingIncrement is not 1 and numberFormat.[[RoundingType]] is not fractionDigits, throw a TypeError exception. assert.throws(TypeError, function() { new Intl.NumberFormat([], {roundingIncrement: 2, roundingPriority: 'morePrecision'}); }, '2, roundingType is "morePrecision"'); @@ -41,8 +39,6 @@ assert.throws(TypeError, function() { new Intl.NumberFormat([], {roundingIncrement: 2, minimumSignificantDigits: 1}); }, '2, roundingType is "significantDigits"'); -// InitializeNumberFormat ( numberFormat, locales, options ) (...) -// 24. If roundingIncrement is not 1 and numberFormat.[[MaximumFractionDigits]] is not equal to numberFormat.[[MinimumFractionDigits]], throw a RangeError exception. assert.throws(RangeError, function() { new Intl.NumberFormat([], {roundingIncrement: 2, maximumFractionDigits:3 , minimumFractionDigits:2 }); }, '"maximumFractionDigits" is not equal to "minimumFractionDigits"');