1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
2 // Copyright (C) 2021 Igalia, S.L. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
6 esid: sec-temporal.zoneddatetime.prototype.tolocalestring
7 description: Throw a TypeError if the receiver is invalid
8 features: [Symbol, Temporal]
11 const toLocaleString = Temporal.ZonedDateTime.prototype.toLocaleString;
13 assert.sameValue(typeof toLocaleString, "function");
15 assert.throws(TypeError, () => toLocaleString.call(undefined), "undefined");
16 assert.throws(TypeError, () => toLocaleString.call(null), "null");
17 assert.throws(TypeError, () => toLocaleString.call(true), "true");
18 assert.throws(TypeError, () => toLocaleString.call(""), "empty string");
19 assert.throws(TypeError, () => toLocaleString.call(Symbol()), "symbol");
20 assert.throws(TypeError, () => toLocaleString.call(1), "1");
21 assert.throws(TypeError, () => toLocaleString.call({}), "plain object");
22 assert.throws(TypeError, () => toLocaleString.call(Temporal.ZonedDateTime), "Temporal.ZonedDateTime");
23 assert.throws(TypeError, () => toLocaleString.call(Temporal.ZonedDateTime.prototype), "Temporal.ZonedDateTime.prototype");