blob: d016c80047d64d0238b5c96d7b90b6c4ae1c9ea4 [file] [log] [blame]
This test checks the behavior of Intl.DateTimeFormat 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.DateTimeFormat is an instance of Function
PASS Intl.DateTimeFormat() is an instance of Intl.DateTimeFormat
PASS Intl.DateTimeFormat.call({}) is an instance of Intl.DateTimeFormat
PASS new Intl.DateTimeFormat() is an instance of Intl.DateTimeFormat
PASS class DerivedDateTimeFormat extends Intl.DateTimeFormat {};(new DerivedDateTimeFormat) instanceof DerivedDateTimeFormat is true
PASS class DerivedDateTimeFormat extends Intl.DateTimeFormat {};(new DerivedDateTimeFormat) instanceof Intl.DateTimeFormat is true
PASS class DerivedDateTimeFormat extends Intl.DateTimeFormat {};new DerivedDateTimeFormat().format(0).length > 0 is true
PASS class DerivedDateTimeFormat extends Intl.DateTimeFormat {};Object.getPrototypeOf(new DerivedDateTimeFormat) === DerivedDateTimeFormat.prototype is true
PASS class DerivedDateTimeFormat extends Intl.DateTimeFormat {};Object.getPrototypeOf(Object.getPrototypeOf(new DerivedDateTimeFormat)) === Intl.DateTimeFormat.prototype is true
PASS Intl.DateTimeFormat.length is 0
PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat, 'prototype').writable is false
PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat, 'prototype').enumerable is false
PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat, 'prototype').configurable is false
PASS Intl.DateTimeFormat.supportedLocalesOf.length is 1
PASS Intl.DateTimeFormat.supportedLocalesOf() is an instance of Array
PASS Intl.DateTimeFormat.supportedLocalesOf.call(null, 'en') is [ 'en' ]
PASS Intl.DateTimeFormat.supportedLocalesOf.call({}, 'en') is [ 'en' ]
PASS Intl.DateTimeFormat.supportedLocalesOf.call(1, 'en') is [ 'en' ]
PASS Intl.DateTimeFormat.supportedLocalesOf(9) is []
PASS Intl.DateTimeFormat.supportedLocalesOf('en') is [ 'en' ]
PASS Intl.DateTimeFormat.supportedLocalesOf({ length: 4, 1: 'en', 0: 'es', 3: 'de' }) is [ 'es', 'en', 'de' ]
PASS Intl.DateTimeFormat.supportedLocalesOf([ 'en', 'pt', 'en', 'es' ]) is [ 'en', 'pt', 'es' ]
PASS Intl.DateTimeFormat.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.DateTimeFormat.supportedLocalesOf('no-bok') is [ 'nb' ]
PASS Intl.DateTimeFormat.supportedLocalesOf('x-some-thing') is []
PASS Intl.DateTimeFormat.supportedLocalesOf(Object.create(null, { length: { get() { throw Error('a') } } })) threw exception Error: a.
PASS Intl.DateTimeFormat.supportedLocalesOf(Object.create(null, { length: { value: 1 }, 0: { get() { throw Error('b') } } })) threw exception Error: b.
PASS Intl.DateTimeFormat.supportedLocalesOf([ { toString() { throw Error('c') } } ]) threw exception Error: c.
PASS Intl.DateTimeFormat.supportedLocalesOf([ 5 ]) threw exception TypeError: locale value must be a string or object.
PASS Intl.DateTimeFormat.supportedLocalesOf('') threw exception RangeError: invalid language tag: .
PASS Intl.DateTimeFormat.supportedLocalesOf('a') threw exception RangeError: invalid language tag: a.
PASS Intl.DateTimeFormat.supportedLocalesOf('abcdefghij') threw exception RangeError: invalid language tag: abcdefghij.
PASS Intl.DateTimeFormat.supportedLocalesOf('#$') threw exception RangeError: invalid language tag: #$.
PASS Intl.DateTimeFormat.supportedLocalesOf('en-@-abc') threw exception RangeError: invalid language tag: en-@-abc.
PASS Intl.DateTimeFormat.supportedLocalesOf('en-u') threw exception RangeError: invalid language tag: en-u.
PASS Intl.DateTimeFormat.supportedLocalesOf('en-u-kn-true-u-ko-true') threw exception RangeError: invalid language tag: en-u-kn-true-u-ko-true.
PASS Intl.DateTimeFormat.supportedLocalesOf('en-x') threw exception RangeError: invalid language tag: en-x.
PASS Intl.DateTimeFormat.supportedLocalesOf('en-*') threw exception RangeError: invalid language tag: en-*.
PASS Intl.DateTimeFormat.supportedLocalesOf('en-') threw exception RangeError: invalid language tag: en-.
PASS Intl.DateTimeFormat.supportedLocalesOf('en--US') threw exception RangeError: invalid language tag: en--US.
PASS Intl.DateTimeFormat.prototype.constructor is Intl.DateTimeFormat
PASS Intl.DateTimeFormat.prototype.format is an instance of Function
PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'format').get is an instance of Function
PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'format').set is undefined
PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'format').enumerable is false
PASS Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'format').configurable is true
PASS Intl.DateTimeFormat.prototype.format.length is 1
PASS Object.defineProperty({}, 'format', Object.getOwnPropertyDescriptor(Intl.DateTimeFormat.prototype, 'format')).format threw exception TypeError: Intl.DateTimeFormat.prototype.format called on value that's not an object initialized as a DateTimeFormat.
PASS Intl.DateTimeFormat.prototype.format !== Intl.DateTimeFormat().format is true
PASS new Intl.DateTimeFormat().format !== new Intl.DateTimeFormat().format is true
PASS Intl.DateTimeFormat.prototype.format({ valueOf() { throw Error('4b') } }) threw exception Error: 4b.
PASS Intl.DateTimeFormat.prototype.format(Infinity) threw exception RangeError: date value is not finite in DateTimeFormat.format().
PASS Intl.DateTimeFormat.prototype.format.call(null, 0) is Intl.DateTimeFormat().format(0)
PASS Intl.DateTimeFormat.prototype.format.call(Intl.DateTimeFormat('ar'), 0) is Intl.DateTimeFormat().format(0)
PASS Intl.DateTimeFormat.prototype.format.call(5, 0) is Intl.DateTimeFormat().format(0)
PASS new Intl.DateTimeFormat().format.call(null, 0) is Intl.DateTimeFormat().format(0)
PASS new Intl.DateTimeFormat().format.call(Intl.DateTimeFormat('ar'), 0) is Intl.DateTimeFormat().format(0)
PASS new Intl.DateTimeFormat().format.call(5, 0) is Intl.DateTimeFormat().format(0)
PASS Intl.DateTimeFormat.prototype.resolvedOptions.length is 0
PASS Intl.DateTimeFormat.prototype.resolvedOptions() is an instance of Object
PASS Intl.DateTimeFormat.prototype.resolvedOptions() === Intl.DateTimeFormat.prototype.resolvedOptions() is false
PASS Intl.DateTimeFormat.prototype.resolvedOptions.call(5) threw exception TypeError: Intl.DateTimeFormat.prototype.resolvedOptions called on value that's not an object initialized as a DateTimeFormat.
PASS successfullyParsed is true
TEST COMPLETE