diff options
Diffstat (limited to 'js/src/tests/test262/intl402/RelativeTimeFormat/prototype/format/branding.js')
-rw-r--r-- | js/src/tests/test262/intl402/RelativeTimeFormat/prototype/format/branding.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/RelativeTimeFormat/prototype/format/branding.js b/js/src/tests/test262/intl402/RelativeTimeFormat/prototype/format/branding.js new file mode 100644 index 0000000000..fa7f890ad7 --- /dev/null +++ b/js/src/tests/test262/intl402/RelativeTimeFormat/prototype/format/branding.js @@ -0,0 +1,28 @@ +// Copyright 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-Intl.RelativeTimeFormat.prototype.format +description: Verifies the branding check for the "format" function of the RelativeTimeFormat prototype object. +info: | + Intl.RelativeTimeFormat.prototype.format( value, unit ) + + 2. If Type(relativeTimeFormat) is not Object or relativeTimeFormat does not have an [[InitializedRelativeTimeFormat]] internal slot whose value is true, throw a TypeError exception. +features: [Intl.RelativeTimeFormat] +---*/ + +const format = Intl.RelativeTimeFormat.prototype.format; + +assert.sameValue(typeof format, "function"); + +assert.throws(TypeError, () => format.call(undefined), "undefined"); +assert.throws(TypeError, () => format.call(null), "null"); +assert.throws(TypeError, () => format.call(true), "true"); +assert.throws(TypeError, () => format.call(""), "empty string"); +assert.throws(TypeError, () => format.call(Symbol()), "symbol"); +assert.throws(TypeError, () => format.call(1), "1"); +assert.throws(TypeError, () => format.call({}), "plain object"); +assert.throws(TypeError, () => format.call(Intl.RelativeTimeFormat), "Intl.RelativeTimeFormat"); +assert.throws(TypeError, () => format.call(Intl.RelativeTimeFormat.prototype), "Intl.RelativeTimeFormat.prototype"); + +reportCompare(0, 0); |