diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js b/js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js new file mode 100644 index 0000000000..68439a2d01 --- /dev/null +++ b/js/src/tests/test262/built-ins/Set/prototype/union/called-with-object.js @@ -0,0 +1,69 @@ +// |reftest| skip -- set-methods is not supported +// Copyright (C) 2023 Anthony Frehner. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-getsetrecord +description: GetSetRecord throws if obj is not an object +info: | + 1. If obj is not an Object, throw a TypeError exception. +features: [set-methods] +---*/ + +let s1 = new Set([1]); +assert.throws( + TypeError, + function () { + s1.union(1); + }, + "number" +); + +assert.throws( + TypeError, + function () { + s1.union(""); + }, + "string" +); + +assert.throws( + TypeError, + function () { + s1.union(1n); + }, + "bigint" +); + +assert.throws( + TypeError, + function () { + s1.union(false); + }, + "boolean" +); + +assert.throws( + TypeError, + function () { + s1.union(undefined); + }, + "undefined" +); + +assert.throws( + TypeError, + function () { + s1.union(null); + }, + "null" +); + +assert.throws( + TypeError, + function () { + s1.union(Symbol("test")); + }, + "symbol" +); + +reportCompare(0, 0); |