mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 23:14:47 +02:00
Added tests with invalid values for calendar and numberingSystem (#2480)
This commit is contained in:
parent
4383f2c6ba
commit
04b1d2254b
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright 2020 Google Inc, Igalia S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-initializedatetimeformat
|
||||||
|
description: >
|
||||||
|
Tests that invalid numberingSystem and calendar option throws RangeError.
|
||||||
|
author: Caio Lima
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let invalidValues = ["ab", "aaaaaaaabbbbbababa."];
|
||||||
|
|
||||||
|
var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
||||||
|
|
||||||
|
invalidValues.forEach(function (value) {
|
||||||
|
assert.throws(RangeError, function () {
|
||||||
|
return new Intl.DateTimeFormat([defaultLocale], {numberingSystem: value});
|
||||||
|
}, "Invalid numberingSystem value " + value + " was not rejected.");
|
||||||
|
assert.throws(RangeError, function () {
|
||||||
|
return new Intl.DateTimeFormat([defaultLocale + "-u-nu-" + value]);
|
||||||
|
}, "Invalid numberingSystem value " + value + " was not rejected.");
|
||||||
|
|
||||||
|
assert.throws(RangeError, function () {
|
||||||
|
return new Intl.DateTimeFormat([defaultLocale], {calendar: value});
|
||||||
|
}, "Invalid calendar value " + value + " was not rejected.");
|
||||||
|
assert.throws(RangeError, function () {
|
||||||
|
return new Intl.DateTimeFormat([defaultLocale + "-u-ca-" + value]);
|
||||||
|
}, "Invalid calendar value " + value + " was not rejected.");
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright 2020 Google Inc, Igalia S.L. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-initializenumberformat
|
||||||
|
description: >
|
||||||
|
Tests that invalid numberingSystem option throws RangeError.
|
||||||
|
author: Caio Lima
|
||||||
|
---*/
|
||||||
|
|
||||||
|
let invalidValues = ["ab", "aaaaaaaabbbbbababa."];
|
||||||
|
|
||||||
|
var defaultLocale = new Intl.NumberFormat().resolvedOptions().locale;
|
||||||
|
|
||||||
|
invalidValues.forEach(function (value) {
|
||||||
|
assert.throws(RangeError, function () {
|
||||||
|
return new Intl.NumberFormat([defaultLocale], {numberingSystem: value});
|
||||||
|
}, "Invalid numberingSystem value " + value + " was not rejected.");
|
||||||
|
assert.throws(RangeError, function () {
|
||||||
|
return new Intl.NumberFormat([defaultLocale + "-u-nu-" + value]);
|
||||||
|
}, "Invalid numberingSystem value " + value + " was not rejected.");
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user