blob: bfc3e775dd09c73997be4802bbbb27e74509b772 [file] [log] [blame]
This test checks the behavior of Intl.NumberFormat as described in the ECMAScript Internationalization API Specification (ECMA-402 2.0).
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Intl.NumberFormat is an instance of Function
PASS Intl.NumberFormat() is an instance of Intl.NumberFormat
PASS Intl.NumberFormat.call({}) is an instance of Intl.NumberFormat
PASS new Intl.NumberFormat() is an instance of Intl.NumberFormat
PASS class DerivedNumberFormat extends Intl.NumberFormat {};(new DerivedNumberFormat) instanceof DerivedNumberFormat is true
PASS class DerivedNumberFormat extends Intl.NumberFormat {};(new DerivedNumberFormat) instanceof Intl.NumberFormat is true
PASS class DerivedNumberFormat extends Intl.NumberFormat {};new DerivedNumberFormat().format(1) === '1' is true
PASS class DerivedNumberFormat extends Intl.NumberFormat {};Object.getPrototypeOf(new DerivedNumberFormat) === DerivedNumberFormat.prototype is true
PASS class DerivedNumberFormat extends Intl.NumberFormat {};Object.getPrototypeOf(Object.getPrototypeOf(new DerivedNumberFormat)) === Intl.NumberFormat.prototype is true
PASS Intl.NumberFormat.length is 0
PASS Object.getOwnPropertyDescriptor(Intl.NumberFormat, 'prototype').writable is false
PASS Object.getOwnPropertyDescriptor(Intl.NumberFormat, 'prototype').enumerable is false
PASS Object.getOwnPropertyDescriptor(Intl.NumberFormat, 'prototype').configurable is false
PASS Intl.NumberFormat.supportedLocalesOf.length is 1
PASS Intl.NumberFormat.supportedLocalesOf() is an instance of Array
PASS Intl.NumberFormat.supportedLocalesOf.call(null, 'en') is [ 'en' ]
PASS Intl.NumberFormat.supportedLocalesOf.call({}, 'en') is [ 'en' ]
PASS Intl.NumberFormat.supportedLocalesOf.call(1, 'en') is [ 'en' ]
PASS Intl.NumberFormat.supportedLocalesOf(9) is []
PASS Intl.NumberFormat.supportedLocalesOf('en') is [ 'en' ]
PASS Intl.NumberFormat.supportedLocalesOf({ length: 4, 1: 'en', 0: 'es', 3: 'de' }) is [ 'es', 'en', 'de' ]
PASS Intl.NumberFormat.supportedLocalesOf([ 'en', 'pt', 'en', 'es' ]) is [ 'en', 'pt', 'es' ]
PASS Intl.NumberFormat.supportedLocalesOf('En-laTn-us-variant2-variant1-1abc-U-ko-tRue-A-aa-aaa-x-RESERVED') is [ 'en-Latn-US-variant2-variant1-1abc-a-aa-aaa-u-ko-true-x-reserved' ]
PASS Intl.NumberFormat.supportedLocalesOf('no-bok') is [ 'nb' ]
PASS Intl.NumberFormat.supportedLocalesOf('x-some-thing') is []
PASS Intl.NumberFormat.supportedLocalesOf(Object.create(null, { length: { get() { throw Error('a') } } })) threw exception Error: a.
PASS Intl.NumberFormat.supportedLocalesOf(Object.create(null, { length: { value: 1 }, 0: { get() { throw Error('b') } } })) threw exception Error: b.
PASS Intl.NumberFormat.supportedLocalesOf([ { toString() { throw Error('c') } } ]) threw exception Error: c.
PASS Intl.NumberFormat.supportedLocalesOf([ 5 ]) threw exception TypeError: locale value must be a string or object.
PASS Intl.NumberFormat.supportedLocalesOf('') threw exception RangeError: invalid language tag: .
PASS Intl.NumberFormat.supportedLocalesOf('a') threw exception RangeError: invalid language tag: a.
PASS Intl.NumberFormat.supportedLocalesOf('abcdefghij') threw exception RangeError: invalid language tag: abcdefghij.
PASS Intl.NumberFormat.supportedLocalesOf('#$') threw exception RangeError: invalid language tag: #$.
PASS Intl.NumberFormat.supportedLocalesOf('en-@-abc') threw exception RangeError: invalid language tag: en-@-abc.
PASS Intl.NumberFormat.supportedLocalesOf('en-u') threw exception RangeError: invalid language tag: en-u.
PASS Intl.NumberFormat.supportedLocalesOf('en-u-kn-true-u-ko-true') threw exception RangeError: invalid language tag: en-u-kn-true-u-ko-true.
PASS Intl.NumberFormat.supportedLocalesOf('en-x') threw exception RangeError: invalid language tag: en-x.
PASS Intl.NumberFormat.supportedLocalesOf('en-*') threw exception RangeError: invalid language tag: en-*.
PASS Intl.NumberFormat.supportedLocalesOf('en-') threw exception RangeError: invalid language tag: en-.
PASS Intl.NumberFormat.supportedLocalesOf('en--US') threw exception RangeError: invalid language tag: en--US.
PASS Intl.NumberFormat.prototype.constructor is Intl.NumberFormat
PASS Intl.NumberFormat.prototype.format is an instance of Function
PASS Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, 'format').get is an instance of Function
PASS Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, 'format').set is undefined
PASS Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, 'format').enumerable is false
PASS Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, 'format').configurable is true
PASS Intl.NumberFormat.prototype.format.length is 1
PASS Object.defineProperty({}, 'format', Object.getOwnPropertyDescriptor(Intl.NumberFormat.prototype, 'format')).format threw exception TypeError: Intl.NumberFormat.prototype.format called on value that's not an object initialized as a NumberFormat.
PASS Intl.NumberFormat.prototype.format !== Intl.NumberFormat().format is true
PASS new Intl.NumberFormat().format !== new Intl.NumberFormat().format is true
PASS Intl.NumberFormat.prototype.format({ valueOf() { throw Error('5') } }) threw exception Error: 5.
PASS Intl.NumberFormat.prototype.format.call(null, 1.2) is Intl.NumberFormat().format(1.2)
PASS Intl.NumberFormat.prototype.format.call(Intl.DateTimeFormat('ar'), 1.2) is Intl.NumberFormat().format(1.2)
PASS Intl.NumberFormat.prototype.format.call(5, 1.2) is Intl.NumberFormat().format(1.2)
PASS new Intl.NumberFormat().format.call(null, 1.2) is Intl.NumberFormat().format(1.2)
PASS new Intl.NumberFormat().format.call(Intl.DateTimeFormat('ar'), 1.2) is Intl.NumberFormat().format(1.2)
PASS new Intl.NumberFormat().format.call(5, 1.2) is Intl.NumberFormat().format(1.2)
PASS Intl.NumberFormat.prototype.resolvedOptions.length is 0
PASS Intl.NumberFormat.prototype.resolvedOptions() is an instance of Object
PASS Intl.NumberFormat.prototype.resolvedOptions() === Intl.NumberFormat.prototype.resolvedOptions() is false
PASS Intl.NumberFormat.prototype.resolvedOptions.call(5) threw exception TypeError: Intl.NumberFormat.prototype.resolvedOptions called on value that's not an object initialized as a NumberFormat.
PASS successfullyParsed is true
TEST COMPLETE