diff --git a/test/built-ins/Temporal/Calendar/prototype/id/branding.js b/test/built-ins/Temporal/Calendar/prototype/id/branding.js new file mode 100644 index 0000000000..c043fab78d --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/id/branding.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.id +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const descriptor = Object.getOwnPropertyDescriptor(Temporal.Calendar.prototype, "id"); +const id = descriptor.get; + +assert.sameValue(typeof id, "function"); + +assert.throws(TypeError, () => id.call(undefined), "undefined"); +assert.throws(TypeError, () => id.call(null), "null"); +assert.throws(TypeError, () => id.call(true), "true"); +assert.throws(TypeError, () => id.call(""), "empty string"); +assert.throws(TypeError, () => id.call(Symbol()), "symbol"); +assert.throws(TypeError, () => id.call(1), "1"); +assert.throws(TypeError, () => id.call({}), "plain object"); +assert.throws(TypeError, () => id.call(Temporal.Calendar), "Temporal.Calendar"); +assert.throws(TypeError, () => id.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/Calendar/prototype/toJSON/branding.js b/test/built-ins/Temporal/Calendar/prototype/toJSON/branding.js new file mode 100644 index 0000000000..38b3dcb2dd --- /dev/null +++ b/test/built-ins/Temporal/Calendar/prototype/toJSON/branding.js @@ -0,0 +1,22 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.calendar.prototype.tojson +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const toJSON = Temporal.Calendar.prototype.toJSON; + +assert.sameValue(typeof toJSON, "function"); + +assert.throws(TypeError, () => toJSON.call(undefined), "undefined"); +assert.throws(TypeError, () => toJSON.call(null), "null"); +assert.throws(TypeError, () => toJSON.call(true), "true"); +assert.throws(TypeError, () => toJSON.call(""), "empty string"); +assert.throws(TypeError, () => toJSON.call(Symbol()), "symbol"); +assert.throws(TypeError, () => toJSON.call(1), "1"); +assert.throws(TypeError, () => toJSON.call({}), "plain object"); +assert.throws(TypeError, () => toJSON.call(Temporal.Calendar), "Temporal.Calendar"); +assert.throws(TypeError, () => toJSON.call(Temporal.Calendar.prototype), "Temporal.Calendar.prototype"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/branding.js b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/branding.js new file mode 100644 index 0000000000..9027fd129c --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/getPlainDateTimeFor/branding.js @@ -0,0 +1,22 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.getplaindatetimefor +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const getPlainDateTimeFor = Temporal.TimeZone.prototype.getPlainDateTimeFor; + + const args = [new Temporal.Instant(0n)]; + +assert.throws(TypeError, () => getPlainDateTimeFor.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => getPlainDateTimeFor.apply(null, args), "null"); +assert.throws(TypeError, () => getPlainDateTimeFor.apply(true, args), "true"); +assert.throws(TypeError, () => getPlainDateTimeFor.apply("", args), "empty string"); +assert.throws(TypeError, () => getPlainDateTimeFor.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => getPlainDateTimeFor.apply(1, args), "1"); +assert.throws(TypeError, () => getPlainDateTimeFor.apply({}, args), "plain object"); +assert.throws(TypeError, () => getPlainDateTimeFor.apply(Temporal.TimeZone, args), "Temporal.TimeZone"); +assert.throws(TypeError, () => getPlainDateTimeFor.apply(Temporal.TimeZone.prototype, args), "Temporal.TimeZone.prototype"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/id/branding.js b/test/built-ins/Temporal/TimeZone/prototype/id/branding.js new file mode 100644 index 0000000000..a29e76837e --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/id/branding.js @@ -0,0 +1,23 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.id +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const descriptor = Object.getOwnPropertyDescriptor(Temporal.TimeZone.prototype, "id"); +const id = descriptor.get; + +assert.sameValue(typeof id, "function"); + +assert.throws(TypeError, () => id.call(undefined), "undefined"); +assert.throws(TypeError, () => id.call(null), "null"); +assert.throws(TypeError, () => id.call(true), "true"); +assert.throws(TypeError, () => id.call(""), "empty string"); +assert.throws(TypeError, () => id.call(Symbol()), "symbol"); +assert.throws(TypeError, () => id.call(1), "1"); +assert.throws(TypeError, () => id.call({}), "plain object"); +assert.throws(TypeError, () => id.call(Temporal.TimeZone), "Temporal.TimeZone"); +assert.throws(TypeError, () => id.call(Temporal.TimeZone.prototype), "Temporal.TimeZone.prototype"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/toJSON/branding.js b/test/built-ins/Temporal/TimeZone/prototype/toJSON/branding.js new file mode 100644 index 0000000000..207c772177 --- /dev/null +++ b/test/built-ins/Temporal/TimeZone/prototype/toJSON/branding.js @@ -0,0 +1,22 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.timezone.prototype.tojson +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const toJSON = Temporal.TimeZone.prototype.toJSON; + +assert.sameValue(typeof toJSON, "function"); + +assert.throws(TypeError, () => toJSON.call(undefined), "undefined"); +assert.throws(TypeError, () => toJSON.call(null), "null"); +assert.throws(TypeError, () => toJSON.call(true), "true"); +assert.throws(TypeError, () => toJSON.call(""), "empty string"); +assert.throws(TypeError, () => toJSON.call(Symbol()), "symbol"); +assert.throws(TypeError, () => toJSON.call(1), "1"); +assert.throws(TypeError, () => toJSON.call({}), "plain object"); +assert.throws(TypeError, () => toJSON.call(Temporal.TimeZone), "Temporal.TimeZone"); +assert.throws(TypeError, () => toJSON.call(Temporal.TimeZone.prototype), "Temporal.TimeZone.prototype");