From e6878420303b062f3a6d59f5e214e89606084cb7 Mon Sep 17 00:00:00 2001 From: Romulo Cintra Date: Tue, 11 Jan 2022 12:00:58 +0100 Subject: [PATCH] update tests --- .../DurationFormat/prototype/format/name.js | 26 +++++++++++++++++++ .../prototype/format/prop-desc.js | 21 +++++++++++++++ .../prototype/format/throw-invoked-as-func.js | 21 +++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 test/intl402/DurationFormat/prototype/format/name.js create mode 100644 test/intl402/DurationFormat/prototype/format/prop-desc.js create mode 100644 test/intl402/DurationFormat/prototype/format/throw-invoked-as-func.js diff --git a/test/intl402/DurationFormat/prototype/format/name.js b/test/intl402/DurationFormat/prototype/format/name.js new file mode 100644 index 0000000000..96ea50d2a8 --- /dev/null +++ b/test/intl402/DurationFormat/prototype/format/name.js @@ -0,0 +1,26 @@ +// Copyright 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.DurationFormat.prototype.format +description: Checks the "name" property of Intl.DurationFormat.prototype.format(). +info: | + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. + +includes: [propertyHelper.js] +features: [Intl.DurationFormat] +---*/ + +verifyProperty(Intl.DurationFormat.prototype.format, "name", { + value: "format", + writable: false, + enumerable: false, + configurable: true +}); diff --git a/test/intl402/DurationFormat/prototype/format/prop-desc.js b/test/intl402/DurationFormat/prototype/format/prop-desc.js new file mode 100644 index 0000000000..9f3162e37a --- /dev/null +++ b/test/intl402/DurationFormat/prototype/format/prop-desc.js @@ -0,0 +1,21 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.DurationFormat.prototype.format +description: Property descriptor of Intl.DurationFormat.prototype.format +includes: [propertyHelper.js] +features: [Intl.DurationFormat] +---*/ + +assert.sameValue( + typeof Intl.DurationFormat.prototype.format, + 'function', + '`typeof Intl.DurationFormat.prototype.format` is `function`' +); + +verifyProperty(Intl.DurationFormat.prototype, 'format', { + enumerable: false, + writable: true, + configurable: true, +}); diff --git a/test/intl402/DurationFormat/prototype/format/throw-invoked-as-func.js b/test/intl402/DurationFormat/prototype/format/throw-invoked-as-func.js new file mode 100644 index 0000000000..fa075a1f41 --- /dev/null +++ b/test/intl402/DurationFormat/prototype/format/throw-invoked-as-func.js @@ -0,0 +1,21 @@ +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-intl.DurationFormat.prototype.format +description: basic tests internal slot initialization and call receiver errors +info: | + Intl.DurationFormat.prototype.format ( duration ) + (...) + 2. Perform ? RequireInternalSlot(df, [[InitializedDurationFormat]]). +features: [Intl.DurationFormat] +---*/ + +const df = new Intl.DurationFormat(); + +// Perform ? RequireInternalSlot(df, [[InitializedDurationFormat]]). +let f = df['format']; + +assert.sameValue(typeof f, 'function'); +assert.throws(TypeError, () => { f('PT12.3456S') }); +