mirror of https://github.com/tc39/test262.git
Sync with pull/100 of intl-numberformat-v3
https://github.com/tc39/proposal-intl-numberformat-v3/pull/100/files
This commit is contained in:
parent
6833180066
commit
e41d581c6d
47
test/intl402/NumberFormat/prototype/formatRange/x-greater-than-y-not-throws.js
vendored
Normal file
47
test/intl402/NumberFormat/prototype/formatRange/x-greater-than-y-not-throws.js
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
// Copyright 2022 Google, Inc. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.NumberFormat.prototype.formatRange
|
||||
description: >
|
||||
"formatRange" basic tests when argument x > y, BigInt included and covers PartitionNumberRangePattern return a string.
|
||||
info: |
|
||||
1.1.21 PartitionNumberRangePattern( numberFormat, x, y )
|
||||
(...)
|
||||
features: [Intl.NumberFormat-v3]
|
||||
---*/
|
||||
|
||||
const nf = new Intl.NumberFormat();
|
||||
|
||||
// If x > y, return a string.
|
||||
assert.sameValue(typeof nf.formatRange(23, 12), "string",
|
||||
"should return string not throw RangeError");
|
||||
|
||||
// If x > y, return a string and both x and y are bigint.
|
||||
assert.sameValue(typeof nf.formatRange(23n, 12n), "string",
|
||||
"should return string not throw RangeError");
|
||||
//if y is -∞, return a string.
|
||||
assert.sameValue(typeof nf.formatRange(23, -Infinity), "string",
|
||||
"should return string not throw RangeError");
|
||||
//if y is -0 and x ≥ 0, return a string.
|
||||
assert.sameValue(typeof nf.formatRange(23, -0), "string",
|
||||
"should return string not throw RangeError");
|
||||
assert.sameValue(typeof nf.formatRange(0, -0), "string",
|
||||
"should return string not throw RangeError");
|
||||
|
||||
// if y is a mathematical value, return a string.
|
||||
assert.sameValue(typeof nf.formatRange(Infinity, 23), "string",
|
||||
"should return string not throw RangeError");
|
||||
// if y is -∞, return a string.
|
||||
assert.sameValue(typeof nf.formatRange(Infinity, -Infinity), "string",
|
||||
"should return string not throw RangeError");
|
||||
// if y is -0, return a string.
|
||||
assert.sameValue(typeof nf.formatRange(Infinity, -0), "string",
|
||||
"should return string not throw RangeError");
|
||||
|
||||
// if y is a mathematical value and y < 0, return a string.
|
||||
assert.sameValue(typeof nf.formatRange(-0, -1), "string",
|
||||
"should return string not throw RangeError");
|
||||
// if y is -∞, return a string.
|
||||
assert.sameValue(typeof nf.formatRange(-0, -Infinity), "string",
|
||||
"should return string not throw RangeError");
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.NumberFormat.prototype.formatRange
|
||||
description: >
|
||||
"formatRange" basic tests when argument x > y, BigInt included and covers PartitionNumberRangePattern throw a RangeError exception.
|
||||
info: |
|
||||
1.1.21 PartitionNumberRangePattern( numberFormat, x, y )
|
||||
(...)
|
||||
1.1.21_2.a. If y is a mathematical value and y < x, throw a RangeError exception.
|
||||
1.1.21._2.b if y is -∞, throw a RangeError exception.
|
||||
1.1.21._2.c if y is -0 and x ≥ 0, throw a RangeError exception.
|
||||
(...)
|
||||
1.1.21._3.a if y is a mathematical value, throw a RangeError exception
|
||||
1.1.21._3.b if y is -∞, throw a RangeError exception.
|
||||
1.1.21._3.c if y is -0, throw a RangeError exception.
|
||||
(...)
|
||||
1.1.21_4.a if y is a mathematical value and y < 0, throw a RangeError exception.
|
||||
1.1.21_4.b if y is -∞, throw a RangeError exception.
|
||||
features: [Intl.NumberFormat-v3]
|
||||
---*/
|
||||
|
||||
const nf = new Intl.NumberFormat();
|
||||
|
||||
// If x > y, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRange(23, 12) });
|
||||
|
||||
// 1.1.21_2 (...)
|
||||
// If x > y, throw a RangeError exception and both x and y are bigint.
|
||||
assert.throws(RangeError, () => { nf.formatRange(23n, 12n) });
|
||||
//if y is -∞, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRange(23, -Infinity) });
|
||||
//if y is -0 and x ≥ 0, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRange(23, -0) });
|
||||
assert.throws(RangeError, () => { nf.formatRange(0, -0) });
|
||||
|
||||
// 1.1.21_3 (...)
|
||||
// if y is a mathematical value, throw a RangeError exception
|
||||
assert.throws(RangeError, () => { nf.formatRange(Infinity, 23) });
|
||||
// if y is -∞, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRange(Infinity, -Infinity) });
|
||||
// if y is -0, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRange(Infinity, -0) });
|
||||
|
||||
// 1.1.21_4 (...)
|
||||
// if y is a mathematical value and y < 0, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRange(-0, -1) });
|
||||
// if y is -∞, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRange(-0, -Infinity) });
|
||||
|
47
test/intl402/NumberFormat/prototype/formatRangeToParts/x-greater-than-y-not-throws.js
vendored
Normal file
47
test/intl402/NumberFormat/prototype/formatRangeToParts/x-greater-than-y-not-throws.js
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
// Copyright 2022 Google, Inc. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.NumberFormat.prototype.formatRangeToParts
|
||||
description: >
|
||||
"formatRangeToParts" basic tests when argument x > y, BigInt included and covers PartitionNumberRangePattern return a object.
|
||||
info: |
|
||||
1.1.21 PartitionNumberRangePattern( numberFormat, x, y )
|
||||
(...)
|
||||
features: [Intl.NumberFormat-v3]
|
||||
---*/
|
||||
|
||||
const nf = new Intl.NumberFormat();
|
||||
|
||||
// If x > y, return a object.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(23, 12), "object",
|
||||
"should return object not throw RangeError");
|
||||
|
||||
// If x > y, return a object and both x and y are bigint.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(23n, 12n), "object",
|
||||
"should return object not throw RangeError");
|
||||
//if y is -∞, return a object.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(23, -Infinity), "object",
|
||||
"should return object not throw RangeError");
|
||||
//if y is -0 and x ≥ 0, return a object.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(23, -0), "object",
|
||||
"should return object not throw RangeError");
|
||||
assert.sameValue(typeof nf.formatRangeToParts(0, -0), "object",
|
||||
"should return object not throw RangeError");
|
||||
|
||||
// if y is a mathematical value, return a object.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(Infinity, 23), "object",
|
||||
"should return object not throw RangeError");
|
||||
// if y is -∞, return a object.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(Infinity, -Infinity), "object",
|
||||
"should return object not throw RangeError");
|
||||
// if y is -0, return a object.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(Infinity, -0), "object",
|
||||
"should return object not throw RangeError");
|
||||
|
||||
// if y is a mathematical value and y < 0, return a object.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(-0, -1), "object",
|
||||
"should return object not throw RangeError");
|
||||
// if y is -∞, return a object.
|
||||
assert.sameValue(typeof nf.formatRangeToParts(-0, -Infinity), "object",
|
||||
"should return object not throw RangeError");
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.NumberFormat.prototype.formatRangeToParts
|
||||
description: >
|
||||
"formatRangeToParts" basic tests when argument x > y, BigInt included and covers PartitionNumberRangePattern throw a RangeError exception.
|
||||
info: |
|
||||
1.1.21 PartitionNumberRangePattern( numberFormat, x, y )
|
||||
(...)
|
||||
1.1.21_2.a. If y is a mathematical value and y < x, throw a RangeError exception.
|
||||
1.1.21._2.b if y is -∞, throw a RangeError exception.
|
||||
1.1.21._2.c if y is -0 and x ≥ 0, throw a RangeError exception.
|
||||
(...)
|
||||
1.1.21._3.a if y is a mathematical value, throw a RangeError exception
|
||||
1.1.21._3.b if y is -∞, throw a RangeError exception.
|
||||
1.1.21._3.c if y is -0, throw a RangeError exception.
|
||||
(...)
|
||||
1.1.21_4.a if y is a mathematical value and y < 0, throw a RangeError exception.
|
||||
1.1.21_4.b if y is -∞, throw a RangeError exception.
|
||||
features: [Intl.NumberFormat-v3]
|
||||
---*/
|
||||
|
||||
const nf = new Intl.NumberFormat();
|
||||
|
||||
// If x > y, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(23, 12) });
|
||||
|
||||
// 1.1.21_2 (...)
|
||||
// If x > y, throw a RangeError exception and both x and y are bigint.
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(23n, 12n) });
|
||||
//if y is -∞, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(23, -Infinity) });
|
||||
//if y is -0 and x ≥ 0, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(23, -0) });
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(0, -0) });
|
||||
|
||||
// 1.1.21_3 (...)
|
||||
// if y is a mathematical value, throw a RangeError exception
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(Infinity, 23) });
|
||||
// if y is -∞, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(Infinity, -Infinity) });
|
||||
// if y is -0, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(Infinity, -0) });
|
||||
|
||||
// 1.1.21_4 (...)
|
||||
// if y is a mathematical value and y < 0, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(-0, -1) });
|
||||
// if y is -∞, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { nf.formatRangeToParts(-0, -Infinity) });
|
||||
|
16
test/intl402/PluralRules/prototype/selectRange/x-greater-than-y-not-throws.js
vendored
Normal file
16
test/intl402/PluralRules/prototype/selectRange/x-greater-than-y-not-throws.js
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2022 Google, Inc. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.PluralRules.prototype.selectRang
|
||||
description: >
|
||||
"selectRange" basic tests when argument x > y, return a string.
|
||||
info: |
|
||||
1.1.6 ResolvePluralRange ( pluralRules, x, y )
|
||||
features: [Intl.NumberFormat-v3]
|
||||
---*/
|
||||
|
||||
const pr = new Intl.PluralRules();
|
||||
|
||||
// 1. If x > y, return a string.
|
||||
assert.sameValue(typeof pr.selectRange(201, 102), "string", "should not throw RangeError");
|
|
@ -1,18 +0,0 @@
|
|||
// Copyright (C) 2021 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.PluralRules.prototype.selectRange
|
||||
description: >
|
||||
"selectRange" basic tests when argument x > y, throw a RangeError exception.
|
||||
info: |
|
||||
1.1.6 ResolvePluralRange ( pluralRules, x, y )
|
||||
(...)
|
||||
5. If x > y, throw a RangeError exception.
|
||||
features: [Intl.NumberFormat-v3]
|
||||
---*/
|
||||
|
||||
const pr = new Intl.PluralRules();
|
||||
|
||||
// 1. If x > y, throw a RangeError exception.
|
||||
assert.throws(RangeError, () => { pr.selectRange(201, 102) });
|
Loading…
Reference in New Issue