diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/toString/options-wrong-type.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/toString/options-wrong-type.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/toString/options-wrong-type.js b/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/toString/options-wrong-type.js new file mode 100644 index 0000000000..130b55c581 --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/toString/options-wrong-type.js @@ -0,0 +1,26 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// Copyright (C) 2022 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.tostring +description: TypeError thrown when options argument is a primitive +features: [BigInt, Symbol, Temporal] +---*/ + +const badOptions = [ + null, + true, + "some string", + Symbol(), + 1, + 2n, +]; + +const instance = new Temporal.PlainTime(); +for (const value of badOptions) { + assert.throws(TypeError, () => instance.toString(value), + `TypeError on wrong options type ${typeof value}`); +}; + +reportCompare(0, 0); |