From b78c6d24be0ba1bfc3a9903d59ccf59b194dce2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 24 Jun 2020 03:18:01 -0700 Subject: [PATCH 1/5] Expect `undefined` when no fractional second digits are present Change the expected value per the current PR. --- ...nstructor-options-fractionalSecondDigits-valid.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid.js b/test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid.js index 3f9fa0d3c69..13d803e47c2 100644 --- a/test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid.js +++ b/test/intl402/DateTimeFormat/constructor-options-fractionalSecondDigits-valid.js @@ -13,10 +13,10 @@ features: [Intl.DateTimeFormat-fractionalSecondDigits] const validOptions = [ - [undefined, 0], - [-0, 0], - [0, 0], - ["0", 0], + [undefined, undefined], + [-0, undefined], + [0, undefined], + ["0", undefined], [1, 1], ["1", 1], [2, 2], @@ -25,9 +25,9 @@ const validOptions = [ ["3", 3], [2.9, 2], ["2.9", 2], - [0.00001, 0], + [0.00001, undefined], [{ toString() { return "3"; } }, 3], - [{ valueOf() { return -0; }, toString: undefined }, 0], + [{ valueOf() { return -0; }, toString: undefined }, undefined], ]; for (const [fractionalSecondDigits, expected] of validOptions) { const dtf = new Intl.DateTimeFormat("en", { fractionalSecondDigits }); From 02ab047287227078ec560a9ea07e3b796a320a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 24 Jun 2020 03:25:15 -0700 Subject: [PATCH 2/5] Updated expected error in NumberFormat constructor per current spec --- test/intl402/NumberFormat/constructor-order.js | 13 ++++++------- test/intl402/NumberFormat/constructor-unit.js | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/test/intl402/NumberFormat/constructor-order.js b/test/intl402/NumberFormat/constructor-order.js index 173ad796b86..4cf16903459 100644 --- a/test/intl402/NumberFormat/constructor-order.js +++ b/test/intl402/NumberFormat/constructor-order.js @@ -10,17 +10,16 @@ info: | 5. Let currency be ? GetOption(options, "currency", "string", undefined, undefined). 6. If currency is not undefined, then a. If the result of IsWellFormedCurrencyCode(currency) is false, throw a RangeError exception. - 9. Let unit be ? GetOption(options, "unit", "string", undefined, undefined). - 10. If unit is not undefined, then + 7. If style is "currency" and currency is undefined, throw a TypeError exception. + ... + 10. Let unit be ? GetOption(options, "unit", "string", undefined, undefined). + 11. If unit is not undefined, then a. If the result of IsWellFormedUnitIdentifier(unit) is false, throw a RangeError exception. - 12. If style is "currency", then - a. If currency is undefined, throw a TypeError exception. - 13. If style is "unit", then - a. If unit is undefined, throw a TypeError exception. + 12. If style is "unit" and unit is undefined, throw a TypeError exception. features: [Intl.NumberFormat-unified] ---*/ -assert.throws(RangeError, () => { +assert.throws(TypeError, () => { new Intl.NumberFormat([], { style: "currency", unit: "test" }) }); diff --git a/test/intl402/NumberFormat/constructor-unit.js b/test/intl402/NumberFormat/constructor-unit.js index c3123c92500..ec83aca9be0 100644 --- a/test/intl402/NumberFormat/constructor-unit.js +++ b/test/intl402/NumberFormat/constructor-unit.js @@ -14,11 +14,24 @@ assert.throws(TypeError, () => { }); for (const unit of ["test", "MILE", "kB"]) { - for (const style of [undefined, "decimal", "currency", "unit"]) { + // Throws RangeError for invalid unit identifier. + for (const style of [undefined, "decimal", "unit"]) { assert.throws(RangeError, () => { new Intl.NumberFormat([], { style, unit }) }, `{ style: ${style}, unit: ${unit} }`); } + + const style = "currency"; + + // Throws TypeError because "currency" option is missing. + assert.throws(TypeError, () => { + new Intl.NumberFormat([], { style, unit }) + }, `{ style: ${style}, unit: ${unit} }`); + + // Throws RangeError for invalid unit identifier. + assert.throws(RangeError, () => { + new Intl.NumberFormat([], { style, unit, currency: "USD" }) + }, `{ style: ${style}, unit: ${unit} }`); } const nf = new Intl.NumberFormat([], { From 3921e70041490f21fdf537fd60a635e95eeb5caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 24 Jun 2020 04:21:13 -0700 Subject: [PATCH 3/5] Remove built-ins/NativeErrors/AggregateError/prototype/errors The `errors` property accessors has been removed from the spec proposal. --- .../prototype/errors/invoked-as-accessor.js | 21 ----- .../prototype/errors/invoked-as-func.js | 25 ------ .../AggregateError/prototype/errors/length.js | 33 -------- .../AggregateError/prototype/errors/name.js | 28 ------- .../prototype/errors/prop-desc.js | 25 ------ .../errors/return-from-iterable-errors.js | 51 ------------- .../errors/return-new-array-from-list.js | 76 ------------------- .../this-has-no-typedarrayname-internal.js | 29 ------- .../prototype/errors/this-is-not-object.js | 46 ----------- 9 files changed, 334 deletions(-) delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/invoked-as-accessor.js delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/invoked-as-func.js delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/length.js delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/name.js delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/prop-desc.js delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/return-from-iterable-errors.js delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/return-new-array-from-list.js delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/this-has-no-typedarrayname-internal.js delete mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors/this-is-not-object.js diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/invoked-as-accessor.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/invoked-as-accessor.js deleted file mode 100644 index 6c2cd1f7cf6..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/invoked-as-accessor.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: > - Requires this value to have a [[AggregateErrorData]] internal slot -info: | - get AggregateError.prototype.errors - - 1. Let E be the this value. - 2. If Type(E) is not Object, throw a TypeError exception. - 3. If E does not have an [[ErrorData]] internal slot, throw a TypeError exception. - 4. If E does not have an [[AggregateErrors]] internal slot, throw a TypeError exception. - 5. Return ! CreateArrayFromList(E.[[AggregateErrors]]). -features: [AggregateError] ----*/ - -assert.throws(TypeError, function() { - AggregateError.prototype.errors; -}); diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/invoked-as-func.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/invoked-as-func.js deleted file mode 100644 index 625b7e4279e..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/invoked-as-func.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: > - Throws a TypeError exception when invoked as a function -info: | - get AggregateError.prototype.errors - - 1. Let E be the this value. - 2. If Type(E) is not Object, throw a TypeError exception. - 3. If E does not have an [[ErrorData]] internal slot, throw a TypeError exception. - 4. If E does not have an [[AggregateErrors]] internal slot, throw a TypeError exception. - 5. Return ! CreateArrayFromList(E.[[AggregateErrors]]). -features: [AggregateError] ----*/ - -var getter = Object.getOwnPropertyDescriptor( - AggregateError.prototype, 'errors' -).get; - -assert.throws(TypeError, function() { - getter(); -}); diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/length.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/length.js deleted file mode 100644 index 9d603b43227..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/length.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: > - Property descriptor of (get AggregateError.prototype.errors).length -info: | - get AggregateError.prototype.errors - - 17 ECMAScript Standard Built-in Objects: - Every built-in Function object, including constructors, has a length - property whose value is an integer. Unless otherwise specified, this - value is equal to the largest number of named arguments shown in the - subclause headings for the function description, including optional - parameters. However, rest parameters shown using the form “...name” - are not included in the default argument count. - - Unless otherwise specified, the length property of a built-in Function - object has the attributes { [[Writable]]: false, [[Enumerable]]: false, - [[Configurable]]: true }. -includes: [propertyHelper.js] -features: [AggregateError] ----*/ - -var desc = Object.getOwnPropertyDescriptor(AggregateError.prototype, 'errors'); - -verifyProperty(desc.get, 'length', { - value: 0, - enumerable: false, - writable: false, - configurable: true -}); diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/name.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/name.js deleted file mode 100644 index 8a2ee17ec2e..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/name.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: > - Property descriptor of (get AggregateError.prototype.errors).name -info: | - get AggregateError.prototype.errors - - 17 ECMAScript Standard Built-in Objects - - Functions that are specified as get or set accessor functions of built-in - properties have "get " or "set " prepended to the property name string. -includes: [propertyHelper.js] -features: [AggregateError] ----*/ - -var desc = Object.getOwnPropertyDescriptor( - AggregateError.prototype, 'errors' -); - -verifyProperty(desc.get, 'name', { - value: 'get errors', - enumerable: false, - writable: false, - configurable: true -}); diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/prop-desc.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/prop-desc.js deleted file mode 100644 index d4334b9db71..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/prop-desc.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: > - "errors" property of AggregateError.prototype -info: | - AggregateError.prototype.errors is an accessor property whose set accessor - function is undefined. - - Section 17: Every accessor property described in clauses 18 through 26 and in - Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true } -includes: [propertyHelper.js] -features: [AggregateError] ----*/ - -var desc = Object.getOwnPropertyDescriptor(AggregateError.prototype, 'errors'); - -assert.sameValue(desc.set, undefined); -assert.sameValue(typeof desc.get, 'function'); - -verifyProperty(AggregateError.prototype, 'errors', { - enumerable: false, - configurable: true -}); diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/return-from-iterable-errors.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/return-from-iterable-errors.js deleted file mode 100644 index 56c4af10c10..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/return-from-iterable-errors.js +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: > - Return a new array from the [[AggregateErrors]] list, after an iterable errors arg. -info: | - get AggregateError.prototype.errors - - 1. Let E be the this value. - ... - 5. Return ! CreateArrayFromList(E.[[AggregateErrors]]). -includes: [compareArray.js] -features: [AggregateError, Symbol.iterator] ----*/ - -var count = 0; -var errors = { - [Symbol.iterator]() { - return { - next() { - count += 1; - return { - done: count === 3, - get value() { - return count * 3; - } - }; - } - }; - } -}; - -var case1 = new AggregateError(errors); - -assert.sameValue(count, 3); - -var get1 = case1.errors; -var get2 = case1.errors; - -assert.sameValue(Array.isArray(get1), true); -assert.sameValue(Array.isArray(get2), true); - -assert.notSameValue(get1, errors, 'creates a new array #1'); -assert.notSameValue(get2, errors, 'creates a new array #2'); -assert.notSameValue(get1, get2, 'creates a new array everytime it gets the values'); - -assert.compareArray(get1, [3, 6], 'get accessor does not trigger a new iteration #1'); -assert.compareArray(get2, [3, 6], 'get accessor does not trigger a new iteration #2'); - -assert.sameValue(count, 3, 'count is preserved'); diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/return-new-array-from-list.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/return-new-array-from-list.js deleted file mode 100644 index e44115ec8e5..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/return-new-array-from-list.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: > - Return a new array from the [[AggregateErrors]] list. -info: | - get AggregateError.prototype.errors - - 1. Let E be the this value. - ... - 5. Return ! CreateArrayFromList(E.[[AggregateErrors]]). -includes: [compareArray.js] -features: [AggregateError, Symbol] ----*/ - -var errors = []; -var case1 = new AggregateError(errors); -var case1get1 = case1.errors; -var case1get2 = case1.errors; - -assert.sameValue(Array.isArray(case1get1), true); -assert.sameValue(Array.isArray(case1get2), true); - -assert.notSameValue(case1get1, errors, 'case1 - creates a new array #1'); -assert.notSameValue(case1get2, errors, 'case1 - creates a new array #2'); -assert.notSameValue(case1get1, case1get2, 'creates a new array everytime it gets the values'); - -assert.compareArray(case1get1, errors); -assert.compareArray(case1get2, errors); - -///// - -errors = [undefined, null, 1, 0, '', {}, Symbol()]; -var case2 = new AggregateError(errors); -var case2get1 = case2.errors; -var case2get2 = case2.errors; - -assert.sameValue(Array.isArray(case2get1), true); -assert.sameValue(Array.isArray(case2get2), true); - -assert.notSameValue(case2get1, errors, 'case2 - creates a new array #1'); -assert.notSameValue(case2get2, errors, 'case2 - creates a new array #2'); -assert.notSameValue(case2get1, case2get2, 'creates a new array everytime it gets the values'); - -assert.compareArray(case2get1, errors); -assert.compareArray(case2get2, errors); - -///// - -errors = [undefined,,,,undefined]; -var case3 = new AggregateError(errors); -var case3get1 = case3.errors; -var case3get2 = case3.errors; - -assert.sameValue(Array.isArray(case3get1), true); -assert.sameValue(Array.isArray(case3get2), true); - -assert.notSameValue(case3get1, errors, 'case3 - creates a new array #1'); -assert.notSameValue(case3get2, errors, 'case3 - creates a new array #2'); -assert.notSameValue(case3get1, case3get2, 'creates a new array everytime it gets the values'); - -assert.compareArray(case3get1, errors); -assert.compareArray(case3get2, errors); - -assert(Object.prototype.hasOwnProperty.call(case3get1, 0), 'filled array from a sparse origin - case3get1, 0'); -assert(Object.prototype.hasOwnProperty.call(case3get1, 1), 'filled array from a sparse origin - case3get1, 1'); -assert(Object.prototype.hasOwnProperty.call(case3get1, 2), 'filled array from a sparse origin - case3get1, 2'); -assert(Object.prototype.hasOwnProperty.call(case3get1, 3), 'filled array from a sparse origin - case3get1, 3'); -assert(Object.prototype.hasOwnProperty.call(case3get1, 4), 'filled array from a sparse origin - case3get1, 4'); - -assert(Object.prototype.hasOwnProperty.call(case3get2, 0), 'filled array from a sparse origin - case3get2, 0'); -assert(Object.prototype.hasOwnProperty.call(case3get2, 1), 'filled array from a sparse origin - case3get2, 1'); -assert(Object.prototype.hasOwnProperty.call(case3get2, 2), 'filled array from a sparse origin - case3get2, 2'); -assert(Object.prototype.hasOwnProperty.call(case3get2, 3), 'filled array from a sparse origin - case3get2, 3'); -assert(Object.prototype.hasOwnProperty.call(case3get2, 4), 'filled array from a sparse origin - case3get2, 4'); diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/this-has-no-typedarrayname-internal.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/this-has-no-typedarrayname-internal.js deleted file mode 100644 index c9b6ebcdc1b..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/this-has-no-typedarrayname-internal.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: > - Throws a TypeError exception when `this` does not have a [[AggregateErrorData]] - internal slot -info: | - get AggregateError.prototype.errors - - 1. Let E be the this value. - 2. If Type(E) is not Object, throw a TypeError exception. - 3. If E does not have an [[ErrorData]] internal slot, throw a TypeError exception. - 4. If E does not have an [[AggregateErrors]] internal slot, throw a TypeError exception. - 5. Return ! CreateArrayFromList(E.[[AggregateErrors]]). -features: [AggregateError] ----*/ - -var getter = Object.getOwnPropertyDescriptor( - AggregateError.prototype, 'errors' -).get; - -assert.throws(TypeError, function() { - getter.call(new Error()); -}, 'this is an instance of Error, no [[AggregateErrors]]'); - -assert.throws(TypeError, function() { - getter.call(AggregateError); -}, 'AggregateError does not have an [[AggregateErrors]] internal'); diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors/this-is-not-object.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors/this-is-not-object.js deleted file mode 100644 index 78130218174..00000000000 --- a/test/built-ins/NativeErrors/AggregateError/prototype/errors/this-is-not-object.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2019 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -esid: sec-get-aggregate-error.prototype.errors -description: Throws a TypeError exception when `this` is not Object -info: | - get AggregateError.prototype.errors - - 1. Let E be the this value. - 2. If Type(E) is not Object, throw a TypeError exception. - ... -features: [AggregateError, Symbol] ----*/ - -var getter = Object.getOwnPropertyDescriptor( - AggregateError.prototype, 'errors' -).get; - -assert.throws(TypeError, function() { - getter.call(undefined); -}, 'this is undefined'); - -assert.throws(TypeError, function() { - getter.call(null); -}, 'this is null'); - -assert.throws(TypeError, function() { - getter.call(42); -}, 'this is 42'); - -assert.throws(TypeError, function() { - getter.call('1'); -}, 'this is a string'); - -assert.throws(TypeError, function() { - getter.call(true); -}, 'this is true'); - -assert.throws(TypeError, function() { - getter.call(false); -}, 'this is false'); - -var s = Symbol('s'); -assert.throws(TypeError, function() { - getter.call(s); -}, 'this is a Symbol'); From a77c4564679eab7e25fccf7043208ff55a9a96dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 24 Jun 2020 04:29:12 -0700 Subject: [PATCH 4/5] Assert 'errors' is absent for AggregateError.prototype --- .../prototype/errors-absent-on-prototype.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/built-ins/NativeErrors/AggregateError/prototype/errors-absent-on-prototype.js diff --git a/test/built-ins/NativeErrors/AggregateError/prototype/errors-absent-on-prototype.js b/test/built-ins/NativeErrors/AggregateError/prototype/errors-absent-on-prototype.js new file mode 100644 index 00000000000..2a7c1731cdc --- /dev/null +++ b/test/built-ins/NativeErrors/AggregateError/prototype/errors-absent-on-prototype.js @@ -0,0 +1,19 @@ +// Copyright (C) 2020 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-properties-of-the-aggregate-error-prototype-objects +description: > + The AggregateError prototype object isn't an AggregateError instance. +info: | + Properties of the AggregateError Prototype Object + + The AggregateError prototype object: + ... + - is not an Error instance or an AggregateError instance and does not have an + [[ErrorData]] internal slot. + ... +features: [AggregateError] +---*/ + +assert.sameValue(AggregateError.prototype.hasOwnProperty("errors"), false); From 75aad9c8d88022389080c26972b9fb74c6f6fe5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Wed, 24 Jun 2020 04:35:39 -0700 Subject: [PATCH 5/5] Update list of non-algorithmic numbering systems Per https://github.com/tc39/ecma402/pull/438 --- harness/testIntl.js | 46 ++++++++++- .../prototype/format/numbering-systems.js | 81 +++++++++++++++---- 2 files changed, 111 insertions(+), 16 deletions(-) diff --git a/harness/testIntl.js b/harness/testIntl.js index 47130ab2419..fe3be6c27a5 100644 --- a/harness/testIntl.js +++ b/harness/testIntl.js @@ -2144,28 +2144,72 @@ function isValidNumberingSystem(name) { */ var numberingSystemDigits = { + adlm: "𞥐𞥑𞥒𞥓𞥔𞥕𞥖𞥗𞥘𞥙", + ahom: "𑜰𑜱𑜲𑜳𑜴𑜵𑜶𑜷𑜸𑜹", arab: "٠١٢٣٤٥٦٧٨٩", arabext: "۰۱۲۳۴۵۶۷۸۹", bali: "\u1B50\u1B51\u1B52\u1B53\u1B54\u1B55\u1B56\u1B57\u1B58\u1B59", beng: "০১২৩৪৫৬৭৮৯", + bhks: "𑱐𑱑𑱒𑱓𑱔𑱕𑱖𑱗𑱘𑱙", + brah: "𑁦𑁧𑁨𑁩𑁪𑁫𑁬𑁭𑁮𑁯", + cakm: "𑄶𑄷𑄸𑄹𑄺𑄻𑄼𑄽𑄾𑄿", + cham: "꩐꩑꩒꩓꩔꩕꩖꩗꩘꩙", deva: "०१२३४५६७८९", + diak: "𑥐𑥑𑥒𑥓𑥔𑥕𑥖𑥗𑥘𑥙", fullwide: "0123456789", + gong: "𑶠𑶡𑶢𑶣𑶤𑶥𑶦𑶧𑶨𑶩", + gonm: "𑵐𑵑𑵒𑵓𑵔𑵕𑵖𑵗𑵘𑵙", gujr: "૦૧૨૩૪૫૬૭૮૯", guru: "੦੧੨੩੪੫੬੭੮੯", hanidec: "〇一二三四五六七八九", + hmng: "𖭐𖭑𖭒𖭓𖭔𖭕𖭖𖭗𖭘𖭙", + hmnp: "𞅀𞅁𞅂𞅃𞅄𞅅𞅆𞅇𞅈𞅉", + java: "꧐꧑꧒꧓꧔꧕꧖꧗꧘꧙", + kali: "꤀꤁꤂꤃꤄꤅꤆꤇꤈꤉", khmr: "០១២៣៤៥៦៧៨៩", knda: "೦೧೨೩೪೫೬೭೮೯", + lana: "᪀᪁᪂᪃᪄᪅᪆᪇᪈᪉", + lanatham: "᪐᪑᪒᪓᪔᪕᪖᪗᪘᪙", laoo: "໐໑໒໓໔໕໖໗໘໙", latn: "0123456789", + lepc: "᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉", limb: "\u1946\u1947\u1948\u1949\u194A\u194B\u194C\u194D\u194E\u194F", + mathbold: "𝟎𝟏𝟐𝟑𝟒𝟓𝟔𝟕𝟖𝟗", + mathdbl: "𝟘𝟙𝟚𝟛𝟜𝟝𝟞𝟟𝟠𝟡", + mathmono: "𝟶𝟷𝟸𝟹𝟺𝟻𝟼𝟽𝟾𝟿", + mathsanb: "𝟬𝟭𝟮𝟯𝟰𝟱𝟲𝟳𝟴𝟵", + mathsans: "𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫", mlym: "൦൧൨൩൪൫൬൭൮൯", + modi: "𑙐𑙑𑙒𑙓𑙔𑙕𑙖𑙗𑙘𑙙", mong: "᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙", + mroo: "𖩠𖩡𖩢𖩣𖩤𖩥𖩦𖩧𖩨𖩩", + mtei: "꯰꯱꯲꯳꯴꯵꯶꯷꯸꯹", mymr: "၀၁၂၃၄၅၆၇၈၉", + mymrshan: "႐႑႒႓႔႕႖႗႘႙", + mymrtlng: "꧰꧱꧲꧳꧴꧵꧶꧷꧸꧹", + newa: "𑑐𑑑𑑒𑑓𑑔𑑕𑑖𑑗𑑘𑑙", + nkoo: "߀߁߂߃߄߅߆߇߈߉", + olck: "᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙", orya: "୦୧୨୩୪୫୬୭୮୯", + osma: "𐒠𐒡𐒢𐒣𐒤𐒥𐒦𐒧𐒨𐒩", + rohg: "𐴰𐴱𐴲𐴳𐴴𐴵𐴶𐴷𐴸𐴹", + saur: "꣐꣑꣒꣓꣔꣕꣖꣗꣘꣙", + segment: "🯰🯱🯲🯳🯴🯵🯶🯷🯸🯹", + shrd: "𑇐𑇑𑇒𑇓𑇔𑇕𑇖𑇗𑇘𑇙", + sind: "𑋰𑋱𑋲𑋳𑋴𑋵𑋶𑋷𑋸𑋹", + sinh: "෦෧෨෩෪෫෬෭෮෯", + sora: "𑃰𑃱𑃲𑃳𑃴𑃵𑃶𑃷𑃸𑃹", + sund: "᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹", + takr: "𑛀𑛁𑛂𑛃𑛄𑛅𑛆𑛇𑛈𑛉", + talu: "᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙", tamldec: "௦௧௨௩௪௫௬௭௮௯", telu: "౦౧౨౩౪౫౬౭౮౯", thai: "๐๑๒๓๔๕๖๗๘๙", - tibt: "༠༡༢༣༤༥༦༧༨༩" + tibt: "༠༡༢༣༤༥༦༧༨༩", + tirh: "𑓐𑓑𑓒𑓓𑓔𑓕𑓖𑓗𑓘𑓙", + vaii: "꘠꘡꘢꘣꘤꘥꘦꘧꘨꘩", + wara: "𑣠𑣡𑣢𑣣𑣤𑣥𑣦𑣧𑣨𑣩", + wcho: "𞋰𞋱𞋲𞋳𞋴𞋵𞋶𞋷𞋸𞋹", }; diff --git a/test/intl402/NumberFormat/prototype/format/numbering-systems.js b/test/intl402/NumberFormat/prototype/format/numbering-systems.js index 73a55775e4c..47b54a396c8 100644 --- a/test/intl402/NumberFormat/prototype/format/numbering-systems.js +++ b/test/intl402/NumberFormat/prototype/format/numbering-systems.js @@ -2,47 +2,98 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -es5id: 11.3.2_FN_3_e +esid: table-numbering-system-digits description: > - Tests that Intl.NumberFormat.prototype.format supports all - alternative numbering systems. + Tests that Intl.NumberFormat.prototype.format supports all + numbering systems with simple digit mappings. author: Roozbeh Pournader ---*/ -var numberingSystems = { +const numberingSystems = { + adlm: 0x1E950, + ahom: 0x11730, arab: 0x0660, arabext: 0x06F0, + bali: 0x1B50, beng: 0x09E6, + bhks: 0x11C50, + brah: 0x11066, + cakm: 0x11136, + cham: 0xAA50, deva: 0x0966, + diak: 0x11950, fullwide: 0xFF10, + gong: 0x11DA0, + gonm: 0x11D50, gujr: 0x0AE6, guru: 0x0A66, hanidec: [0x3007, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D], + hmng: 0x16B50, + hmnp: 0x1E140, + java: 0xA9D0, + kali: 0xA900, khmr: 0x17E0, knda: 0x0CE6, + lana: 0x1A80, + lanatham: 0x1A90, laoo: 0x0ED0, latn: 0x0030, + lepc: 0x1C40, + limb: 0x1946, + mathbold: 0x1D7CE, + mathdbl: 0x1D7D8, + mathmono: 0x1D7F6, + mathsanb: 0x1D7EC, + mathsans: 0x1D7E2, mlym: 0x0D66, + modi: 0x11650, mong: 0x1810, + mroo: 0x16A60, + mtei: 0xABF0, mymr: 0x1040, + mymrshan: 0x1090, + mymrtlng: 0xA9F0, + newa: 0x11450, + nkoo: 0x07C0, + olck: 0x1C50, orya: 0x0B66, + osma: 0x104A0, + rohg: 0x10D30, + saur: 0xA8D0, + segment: 0x1FBF0, + shrd: 0x111D0, + sind: 0x112F0, + sinh: 0x0DE6, + sora: 0x110F0, + sund: 0x1BB0, + takr: 0x116C0, + talu: 0x19D0, tamldec: 0x0BE6, telu: 0x0C66, thai: 0x0E50, - tibt: 0x0F20 + tibt: 0x0F20, + tirh: 0x114D0, + vaii: 0xA620, + wara: 0x118E0, + wcho: 0x1E2F0, }; -var options, formatter; -var s, zeroCode, digitList; +for (let [numberingSystem, digitList] of Object.entries(numberingSystems)) { + if (typeof digitList === 'number') { + let zeroCode = digitList; + digitList = []; + for (let i = 0; i <= 9; ++i) { + digitList[i] = zeroCode + i; + } + } + + assert.sameValue(digitList.length, 10); -for (s in numberingSystems) { - zeroCode = numberingSystems[s]; - if (typeof zeroCode === 'number') { - digitList = [zeroCode, zeroCode+1, zeroCode+2, zeroCode+3, zeroCode+4, - zeroCode+5, zeroCode+6, zeroCode+7, zeroCode+8, zeroCode+9]; - numberingSystems[s] = digitList; + let nf = new Intl.NumberFormat(undefined, {numberingSystem}); + + for (let i = 0; i <= 9; ++i) { + assert.sameValue(nf.format(i), String.fromCodePoint(digitList[i]), + `numberingSystem: ${numberingSystem}, digit: ${i}`); } } - -// FIXME: Unfinished