diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/add/argument-not-object.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/add/argument-not-object.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/add/argument-not-object.js b/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/add/argument-not-object.js new file mode 100644 index 0000000000..76496e794e --- /dev/null +++ b/js/src/tests/test262/built-ins/Temporal/PlainTime/prototype/add/argument-not-object.js @@ -0,0 +1,22 @@ +// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally +// Copyright (C) 2020 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.plaintime.prototype.add +description: Passing a primitive other than string to add() throws +features: [Symbol, Temporal] +---*/ + +const instance = new Temporal.PlainTime(15, 30, 45, 987, 654, 321); +assert.throws(TypeError, () => instance.add(undefined), "undefined"); +assert.throws(TypeError, () => instance.add(null), "null"); +assert.throws(TypeError, () => instance.add(true), "boolean"); +assert.throws(RangeError, () => instance.add(""), "empty string"); +assert.throws(TypeError, () => instance.add(Symbol()), "Symbol"); +assert.throws(TypeError, () => instance.add(7), "number"); +assert.throws(TypeError, () => instance.add(7n), "bigint"); +assert.throws(TypeError, () => instance.add([]), "array"); +assert.throws(TypeError, () => instance.add(() => {}), "function"); + +reportCompare(0, 0); |