From bad7c0487ee1edf4a9059ff2a51fd19fc2d53170 Mon Sep 17 00:00:00 2001 From: Jamie Kyle Date: Wed, 16 Jun 2021 14:35:06 -0700 Subject: [PATCH] Add tests for Object.hasOwn (#2995) * Add tests for Object.hasOwn * Update test/built-ins/Object/hasOwn/length.js Co-authored-by: Jordan Harband * Update test/built-ins/Object/hasOwn/name.js Co-authored-by: Jordan Harband * Fixup comments for Object.hasOwn * Add Object.hasOwn descriptor test * use assert.sameValue with true instead of assert() * remove extra semicolons * Remove old $ERROR style tests from hasown * Fix thrown error type in hasown tests * Fix incorrect test cases Co-authored-by: Jordan Harband --- features.txt | 4 ++ test/built-ins/Object/hasOwn/descriptor.js | 15 ++++++ test/built-ins/Object/hasOwn/hasown.js | 19 ++++++++ .../Object/hasOwn/hasown_inherited_exists.js | 16 +++++++ .../Object/hasOwn/hasown_inherited_getter.js | 18 +++++++ .../hasown_inherited_getter_and_setter.js | 22 +++++++++ ...tter_and_setter_configurable_enumerable.js | 25 ++++++++++ ...r_and_setter_configurable_nonenumerable.js | 24 ++++++++++ ...r_and_setter_nonconfigurable_enumerable.js | 24 ++++++++++ ...nd_setter_nonconfigurable_nonenumerable.js | 23 +++++++++ ...nherited_getter_configurable_enumerable.js | 23 +++++++++ ...rited_getter_configurable_nonenumerable.js | 22 +++++++++ ...rited_getter_nonconfigurable_enumerable.js | 22 +++++++++ ...ed_getter_nonconfigurable_nonenumerable.js | 21 ++++++++ ...ted_nonwritable_configurable_enumerable.js | 21 ++++++++ ..._nonwritable_configurable_nonenumerable.js | 20 ++++++++ ..._nonwritable_nonconfigurable_enumerable.js | 20 ++++++++ ...nwritable_nonconfigurable_nonenumerable.js | 19 ++++++++ .../Object/hasOwn/hasown_inherited_setter.js | 17 +++++++ ...nherited_setter_configurable_enumerable.js | 22 +++++++++ ...rited_setter_configurable_nonenumerable.js | 21 ++++++++ ...rited_setter_nonconfigurable_enumerable.js | 21 ++++++++ ...ed_setter_nonconfigurable_nonenumerable.js | 20 ++++++++ ...erited_writable_configurable_enumerable.js | 22 +++++++++ ...ted_writable_configurable_nonenumerable.js | 21 ++++++++ ...ted_writable_nonconfigurable_enumerable.js | 21 ++++++++ ..._writable_nonconfigurable_nonenumerable.js | 20 ++++++++ .../Object/hasOwn/hasown_nonexistent.js | 13 +++++ .../Object/hasOwn/hasown_own_getter.js | 17 +++++++ .../hasOwn/hasown_own_getter_and_setter.js | 21 ++++++++ ...tter_and_setter_configurable_enumerable.js | 24 ++++++++++ ...r_and_setter_configurable_nonenumerable.js | 23 +++++++++ ...r_and_setter_nonconfigurable_enumerable.js | 23 +++++++++ ...nd_setter_nonconfigurable_nonenumerable.js | 22 +++++++++ ...sown_own_getter_configurable_enumerable.js | 22 +++++++++ ...n_own_getter_configurable_nonenumerable.js | 21 ++++++++ ...n_own_getter_nonconfigurable_enumerable.js | 21 ++++++++ ...wn_getter_nonconfigurable_nonenumerable.js | 20 ++++++++ ...own_nonwritable_configurable_enumerable.js | 20 ++++++++ ..._nonwritable_nonconfigurable_enumerable.js | 19 ++++++++ ...nonwriteable_configurable_nonenumerable.js | 19 ++++++++ ...writeable_nonconfigurable_nonenumerable.js | 18 +++++++ .../hasOwn/hasown_own_property_exists.js | 15 ++++++ .../Object/hasOwn/hasown_own_setter.js | 16 +++++++ ...sown_own_setter_configurable_enumerable.js | 21 ++++++++ ...n_own_setter_configurable_nonenumerable.js | 20 ++++++++ ...n_own_setter_nonconfigurable_enumerable.js | 20 ++++++++ ...wn_setter_nonconfigurable_nonenumerable.js | 19 ++++++++ ...wn_own_writable_configurable_enumerable.js | 21 ++++++++ ...own_writable_configurable_nonenumerable.js | 20 ++++++++ ...own_writable_nonconfigurable_enumerable.js | 20 ++++++++ ..._writable_nonconfigurable_nonenumerable.js | 19 ++++++++ test/built-ins/Object/hasOwn/length.js | 31 ++++++++++++ test/built-ins/Object/hasOwn/name.js | 28 +++++++++++ .../Object/hasOwn/not-a-constructor.js | 33 +++++++++++++ test/built-ins/Object/hasOwn/prototype.js | 13 +++++ .../Object/hasOwn/symbol_own_property.js | 32 +++++++++++++ .../hasOwn/symbol_property_toPrimitive.js | 35 ++++++++++++++ .../Object/hasOwn/symbol_property_toString.js | 39 +++++++++++++++ .../Object/hasOwn/symbol_property_valueOf.js | 37 ++++++++++++++ .../hasOwn/toobject_before_topropertykey.js | 48 +++++++++++++++++++ test/built-ins/Object/hasOwn/toobject_null.js | 15 ++++++ .../Object/hasOwn/toobject_undefined.js | 15 ++++++ 63 files changed, 1363 insertions(+) create mode 100644 test/built-ins/Object/hasOwn/descriptor.js create mode 100644 test/built-ins/Object/hasOwn/hasown.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_exists.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_setter.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_nonexistent.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_and_setter.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_nonwritable_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_nonwritable_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_nonwriteable_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_nonwriteable_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_property_exists.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_setter.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_setter_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_setter_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_writable_configurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_writable_configurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_enumerable.js create mode 100644 test/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_nonenumerable.js create mode 100644 test/built-ins/Object/hasOwn/length.js create mode 100644 test/built-ins/Object/hasOwn/name.js create mode 100644 test/built-ins/Object/hasOwn/not-a-constructor.js create mode 100644 test/built-ins/Object/hasOwn/prototype.js create mode 100644 test/built-ins/Object/hasOwn/symbol_own_property.js create mode 100644 test/built-ins/Object/hasOwn/symbol_property_toPrimitive.js create mode 100644 test/built-ins/Object/hasOwn/symbol_property_toString.js create mode 100644 test/built-ins/Object/hasOwn/symbol_property_valueOf.js create mode 100644 test/built-ins/Object/hasOwn/toobject_before_topropertykey.js create mode 100644 test/built-ins/Object/hasOwn/toobject_null.js create mode 100644 test/built-ins/Object/hasOwn/toobject_undefined.js diff --git a/features.txt b/features.txt index edab64c4fa..b6a872d4d2 100644 --- a/features.txt +++ b/features.txt @@ -205,6 +205,10 @@ arbitrary-module-namespace-names # https://github.com/tc39/ecma262/pull/2164 align-detached-buffer-semantics-with-web-reality +# Object.hasOwn +# https://github.com/tc39/proposal-accessible-object-hasownproperty +Object.hasOwn + ## Standard language features # # Language features that have been included in a published version of the diff --git a/test/built-ins/Object/hasOwn/descriptor.js b/test/built-ins/Object/hasOwn/descriptor.js new file mode 100644 index 0000000000..b6b3b147f2 --- /dev/null +++ b/test/built-ins/Object/hasOwn/descriptor.js @@ -0,0 +1,15 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Testing descriptor property of Object.hasOwn +includes: + - propertyHelper.js +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +verifyWritable(Object, "hasOwn"); +verifyNotEnumerable(Object, "hasOwn"); +verifyConfigurable(Object, "hasOwn"); diff --git a/test/built-ins/Object/hasOwn/hasown.js b/test/built-ins/Object/hasOwn/hasown.js new file mode 100644 index 0000000000..bee30908b7 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown.js @@ -0,0 +1,19 @@ +// Copyright 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +info: | + Object.hasOwn ( _O_, _P_ ) + + 1. Let _obj_ be ? ToObject(_O_). + 2. Let _key_ be ? ToPropertyKey(_P_). + 3. Return ? HasOwnProperty(_obj_, _key_). +description: > + Checking type of the Object.hasOwn and the returned result +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +assert.sameValue(typeof Object.hasOwn, 'function'); +assert(Object.hasOwn(Object, 'hasOwn')); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_exists.js b/test/built-ins/Object/hasOwn/hasown_inherited_exists.js new file mode 100644 index 0000000000..953edd0bd8 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_exists.js @@ -0,0 +1,16 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Properties - [[HasOwnProperty]] (old style inherited property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = { + foo: 42 +}; +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter.js new file mode 100644 index 0000000000..9047a99f75 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter.js @@ -0,0 +1,18 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Properties - [[HasOwnProperty]] (literal inherited getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = { + get foo() { + return 42; + } +}; +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter.js new file mode 100644 index 0000000000..0bc55835ac --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter.js @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (literal inherited getter/setter + property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = { + get foo() { + return 42; + }, + set foo(x) { + } +}; +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_enumerable.js new file mode 100644 index 0000000000..251ce7f956 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_enumerable.js @@ -0,0 +1,25 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, enumerable + inherited getter/setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + get: function() { + return 42; + }, + set: function() {; + }, + enumerable: true, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_nonenumerable.js new file mode 100644 index 0000000000..2226df0168 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_nonenumerable.js @@ -0,0 +1,24 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, non-enumerable + inherited getter/setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + get: function() { + return 42; + }, + set: function() {; + }, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..2cc7356225 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_enumerable.js @@ -0,0 +1,24 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, enumerable + inherited getter/setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + get: function() { + return 42; + }, + set: function() {; + }, + enumerable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..3177adc5b0 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_nonenumerable.js @@ -0,0 +1,23 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, non-enumerable + inherited getter/setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + get: function() { + return 42; + }, + set: function() {; + } +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_enumerable.js new file mode 100644 index 0000000000..ff3d86abb1 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_enumerable.js @@ -0,0 +1,23 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, enumerable + inherited getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + get: function() { + return 42; + }, + enumerable: true, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_nonenumerable.js new file mode 100644 index 0000000000..9f8f51eb0f --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_nonenumerable.js @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, non-enumerable + inherited getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + get: function() { + return 42; + }, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..eb9d7f2353 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_enumerable.js @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, enumerable + inherited getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + get: function() { + return 42; + }, + enumerable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..989fffe1d1 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_nonenumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, non-enumerable + inherited getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + get: function() { + return 42; + } +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_enumerable.js new file mode 100644 index 0000000000..6ea1dc684f --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_enumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-writable, configurable, + enumerable inherited value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + value: 42, + configurable: true, + enumerable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_nonenumerable.js new file mode 100644 index 0000000000..7eef433550 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_nonenumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-writable, configurable, + non-enumerable inherited value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + value: 42, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..8198a45401 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_enumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-writable, non-configurable, + enumerable inherited value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + value: 42, + enumerable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..2e1835b16b --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_nonenumerable.js @@ -0,0 +1,19 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-writable, non-configurable, + non-enumerable inherited value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + value: 42 +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_setter.js b/test/built-ins/Object/hasOwn/hasown_inherited_setter.js new file mode 100644 index 0000000000..7fbb8efb72 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_setter.js @@ -0,0 +1,17 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Properties - [[HasOwnProperty]] (literal inherited setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = { + set foo(x) { + } +}; +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_enumerable.js new file mode 100644 index 0000000000..05d3528408 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_enumerable.js @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, enumerable + inherited setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + set: function() {; + }, + enumerable: true, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_nonenumerable.js new file mode 100644 index 0000000000..b47e77a811 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_nonenumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, non-enumerable + inherited setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + set: function() {; + }, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..15b0aa235e --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_enumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, enumerable + inherited setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + set: function() {; + }, + enumerable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..4955c13428 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_nonenumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, non-enumerable + inherited setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + set: function() {; + } +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_enumerable.js new file mode 100644 index 0000000000..8ac30cbe0e --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_enumerable.js @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (writable, configurable, + enumerable inherited value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + value: 42, + writable: true, + enumerable: true, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_nonenumerable.js new file mode 100644 index 0000000000..5622645a4a --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_nonenumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (writable, configurable, + non-enumerable inherited value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + value: 42, + writable: true, + configurable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..e636012e17 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_enumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (writable, non-configurable, + enumerable inherited value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + value: 42, + writable: true, + enumerable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..3a41fff47d --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_nonenumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (writable, non-configurable, + non-enumerable inherited value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var base = {}; +Object.defineProperty(base, "foo", { + value: 42, + writable: true +}); +var o = Object.create(base); + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_nonexistent.js b/test/built-ins/Object/hasOwn/hasown_nonexistent.js new file mode 100644 index 0000000000..dc3736ef5b --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_nonexistent.js @@ -0,0 +1,13 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Properties - [[HasOwnProperty]] (property does not exist) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter.js b/test/built-ins/Object/hasOwn/hasown_own_getter.js new file mode 100644 index 0000000000..f748804660 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter.js @@ -0,0 +1,17 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Properties - [[HasOwnProperty]] (literal own getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = { + get foo() { + return 42; + } +}; + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter.js b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter.js new file mode 100644 index 0000000000..5a0e9d89cd --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (literal own getter/setter + property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = { + get foo() { + return 42; + }, + set foo(x) { + } +}; + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_enumerable.js new file mode 100644 index 0000000000..141860b525 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_enumerable.js @@ -0,0 +1,24 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, enumerable own + getter/setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + get: function() { + return 42; + }, + set: function() {; + }, + enumerable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_nonenumerable.js new file mode 100644 index 0000000000..52bd01b4b4 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_nonenumerable.js @@ -0,0 +1,23 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, non-enumerable own + getter/setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + get: function() { + return 42; + }, + set: function() {; + }, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..ad82edeb6f --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_enumerable.js @@ -0,0 +1,23 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, enumerable own + getter/setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + get: function() { + return 42; + }, + set: function() {; + }, + enumerable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..01a3fbf917 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_nonenumerable.js @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, non-enumerable + own getter/setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + get: function() { + return 42; + }, + set: function() {; + } +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_getter_configurable_enumerable.js new file mode 100644 index 0000000000..8e5c54dfb0 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_configurable_enumerable.js @@ -0,0 +1,22 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, enumerable own + getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + get: function() { + return 42; + }, + enumerable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_getter_configurable_nonenumerable.js new file mode 100644 index 0000000000..39d9218a5f --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_configurable_nonenumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, non-enumerable own + getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + get: function() { + return 42; + }, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..87385974b5 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_enumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, enumerable own + getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + get: function() { + return 42; + }, + enumerable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..cf5ef0de69 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_nonenumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, non-enumerable + own getter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + get: function() { + return 42; + } +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_nonwritable_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_nonwritable_configurable_enumerable.js new file mode 100644 index 0000000000..c3a0b437ab --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_nonwritable_configurable_enumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-writable, configurable, + enumerable own value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + value: 42, + configurable: true, + enumerable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_nonwritable_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_nonwritable_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..af9ddd8725 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_nonwritable_nonconfigurable_enumerable.js @@ -0,0 +1,19 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-writable, non-configurable, + enumerable own value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + value: 42, + enumerable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_nonwriteable_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_nonwriteable_configurable_nonenumerable.js new file mode 100644 index 0000000000..1b396465d2 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_nonwriteable_configurable_nonenumerable.js @@ -0,0 +1,19 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-writable, configurable, + non-enumerable own value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + value: 42, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_nonwriteable_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_nonwriteable_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..edfdfd3109 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_nonwriteable_nonconfigurable_nonenumerable.js @@ -0,0 +1,18 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-writable, non-configurable, + non-enumerable own value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + value: 42 +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_property_exists.js b/test/built-ins/Object/hasOwn/hasown_own_property_exists.js new file mode 100644 index 0000000000..e2e2706490 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_property_exists.js @@ -0,0 +1,15 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Properties - [[HasOwnProperty]] (old style own property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = { + foo: 42 +}; + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_setter.js b/test/built-ins/Object/hasOwn/hasown_own_setter.js new file mode 100644 index 0000000000..44c021670d --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_setter.js @@ -0,0 +1,16 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Properties - [[HasOwnProperty]] (literal own setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = { + set foo(x) { + } +}; + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_setter_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_setter_configurable_enumerable.js new file mode 100644 index 0000000000..1dd509ab67 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_setter_configurable_enumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, enumerable own + setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + set: function() {; + }, + enumerable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_setter_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_setter_configurable_nonenumerable.js new file mode 100644 index 0000000000..ddb6d1bd30 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_setter_configurable_nonenumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (configurable, non-enumerable own + setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + set: function() {; + }, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..7eff9b2a89 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_enumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, enumerable own + setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + set: function() {; + }, + enumerable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..68a29cb697 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_nonenumerable.js @@ -0,0 +1,19 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (non-configurable, non-enumerable + own setter property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + set: function() {; + } +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_writable_configurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_writable_configurable_enumerable.js new file mode 100644 index 0000000000..d91d446982 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_writable_configurable_enumerable.js @@ -0,0 +1,21 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (writable, configurable, + enumerable own value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + value: 42, + writable: true, + enumerable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_writable_configurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_writable_configurable_nonenumerable.js new file mode 100644 index 0000000000..55bcbe1911 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_writable_configurable_nonenumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (writable, configurable, + non-enumerable own value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + value: 42, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_enumerable.js b/test/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..1a05522dd5 --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_enumerable.js @@ -0,0 +1,20 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (writable, non-configurable, + enumerable own value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + value: 42, + writable: true, + enumerable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_nonenumerable.js b/test/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..66925846bd --- /dev/null +++ b/test/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_nonenumerable.js @@ -0,0 +1,19 @@ +// Copyright (c) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Properties - [[HasOwnProperty]] (writable, non-configurable, + non-enumerable own value property) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; +Object.defineProperty(o, "foo", { + value: 42, + writable: true +}); + +assert.sameValue(Object.hasOwn(o, "foo"), true, 'Object.hasOwn(o, "foo") !== true'); diff --git a/test/built-ins/Object/hasOwn/length.js b/test/built-ins/Object/hasOwn/length.js new file mode 100644 index 0000000000..47c6abb0ab --- /dev/null +++ b/test/built-ins/Object/hasOwn/length.js @@ -0,0 +1,31 @@ +// Copyright (C) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Object.hasOwn.length is 2. +info: | + Object.hasOwn ( _O_, _P_ ) + + ECMAScript Standard Built-in Objects + + Every built-in function object, including constructors, has a "length" + property whose value is an integer. Unless otherwise specified, this + value is equal to the largest number of named arguments shown in the + subclause headings for the function description. + + Unless otherwise specified, the "length" property of a built-in Function + object has the attributes { [[Writable]]: false, [[Enumerable]]: false, + [[Configurable]]: true }. +includes: [propertyHelper.js] +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +verifyProperty(Object.hasOwn, "length", { + value: 2, + writable: false, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Object/hasOwn/name.js b/test/built-ins/Object/hasOwn/name.js new file mode 100644 index 0000000000..d6859df89b --- /dev/null +++ b/test/built-ins/Object/hasOwn/name.js @@ -0,0 +1,28 @@ +// Copyright (C) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Object.hasOwn.name is "hasOwn". +info: | + Object.hasOwn ( _O_, _P_ ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +assert.sameValue(Object.hasOwn.name, "hasOwn"); + +verifyNotEnumerable(Object.hasOwn, "name"); +verifyNotWritable(Object.hasOwn, "name"); +verifyConfigurable(Object.hasOwn, "name"); diff --git a/test/built-ins/Object/hasOwn/not-a-constructor.js b/test/built-ins/Object/hasOwn/not-a-constructor.js new file mode 100644 index 0000000000..901d94b32e --- /dev/null +++ b/test/built-ins/Object/hasOwn/not-a-constructor.js @@ -0,0 +1,33 @@ +// Copyright (C) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Object.hasOwn does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +author: Jamie Kyle +features: [Reflect.construct, arrow-function, Object.hasOwn] +---*/ + +assert.sameValue( + isConstructor(Object.hasOwn), + false, + 'isConstructor(Object.hasOwn) must return false' +); + +assert.throws(TypeError, () => { + new Object.hasOwn(''); +}, '`new Object.hasOwn(\'\')` throws TypeError'); diff --git a/test/built-ins/Object/hasOwn/prototype.js b/test/built-ins/Object/hasOwn/prototype.js new file mode 100644 index 0000000000..c0003e67c0 --- /dev/null +++ b/test/built-ins/Object/hasOwn/prototype.js @@ -0,0 +1,13 @@ +// Copyright 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +info: Object.hasOwn has not prototype property +description: > + Checking if obtaining the prototype property of Object.hasOwn fails +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +assert.sameValue(Object.hasOwn.prototype, undefined); diff --git a/test/built-ins/Object/hasOwn/symbol_own_property.js b/test/built-ins/Object/hasOwn/symbol_own_property.js new file mode 100644 index 0000000000..f10dd084fc --- /dev/null +++ b/test/built-ins/Object/hasOwn/symbol_own_property.js @@ -0,0 +1,32 @@ +// Copyright (C) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Object.hasOwn called with symbol property key +info: | + Object.hasOwn ( _O_, _P_ ) + + 1. Let _obj_ be ? ToObject(_O_). + 1. Let _key_ be ? ToPropertyKey(_P_). + ... +author: Jamie Kyle +features: [Symbol, Object.hasOwn] +---*/ + +var obj = {}; +var sym = Symbol(); + +assert.sameValue( + Object.hasOwn(obj, sym), + false, + "Returns false if symbol own property not found" +); + +obj[sym] = 0; + +assert.sameValue( + Object.hasOwn(obj, sym), + true, + "Returns true if symbol own property found" +); diff --git a/test/built-ins/Object/hasOwn/symbol_property_toPrimitive.js b/test/built-ins/Object/hasOwn/symbol_property_toPrimitive.js new file mode 100644 index 0000000000..a4fee7f8e1 --- /dev/null +++ b/test/built-ins/Object/hasOwn/symbol_property_toPrimitive.js @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Object.hasOwn with symbol and @@toPrimitive conversion +info: | + Object.hasOwn ( _O_, _P_ ) + + 1. Let _obj_ be ? ToObject(_O_). + 1. Let _key_ be ? ToPropertyKey(_P_). + ... +author: Jamie Kyle +features: [Symbol.toPrimitive, Object.hasOwn] +---*/ + +var obj = {}; +var sym = Symbol(); + +var callCount = 0; +var wrapper = {}; +wrapper[Symbol.toPrimitive] = function() { + callCount += 1; + return sym; +}; + +obj[sym] = 0; + +assert.sameValue( + Object.hasOwn(obj, wrapper), + true, + "Returns true if symbol own property found" +); + +assert.sameValue(callCount, 1, "toPrimitive method called exactly once"); diff --git a/test/built-ins/Object/hasOwn/symbol_property_toString.js b/test/built-ins/Object/hasOwn/symbol_property_toString.js new file mode 100644 index 0000000000..cfc870b5eb --- /dev/null +++ b/test/built-ins/Object/hasOwn/symbol_property_toString.js @@ -0,0 +1,39 @@ +// Copyright (C) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Object.hasOwn with symbol and toString conversion +info: | + Object.hasOwn ( _O_, _P_ ) + + 1. Let _obj_ be ? ToObject(_O_). + 1. Let _key_ be ? ToPropertyKey(_P_). + ... +author: Jamie Kyle +features: [Symbol, Object.hasOwn] +---*/ + +var obj = {}; +var sym = Symbol(); + +var callCount = 0; +var wrapper = { + toString: function() { + callCount += 1; + return sym; + }, + valueOf: function () { + throw new Test262Error("valueOf() called") + } +}; + +obj[sym] = 0; + +assert.sameValue( + Object.hasOwn(obj, wrapper), + true, + "Returns true if symbol own property found" +); + +assert.sameValue(callCount, 1, "toString method called exactly once"); diff --git a/test/built-ins/Object/hasOwn/symbol_property_valueOf.js b/test/built-ins/Object/hasOwn/symbol_property_valueOf.js new file mode 100644 index 0000000000..82a1ae1e1b --- /dev/null +++ b/test/built-ins/Object/hasOwn/symbol_property_valueOf.js @@ -0,0 +1,37 @@ +// Copyright (C) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: Object.hasOwn with symbol and valueOf conversion +info: | + Object.hasOwn ( _O_, _P_ ) + + 1. Let _obj_ be ? ToObject(_O_). + 2. Let _key_ be ? ToPropertyKey(_P_). + ... +author: Jamie Kyle +features: [Symbol, Object.hasOwn] +---*/ + +var obj = {}; +var sym = Symbol(); + +var callCount = 0; +var wrapper = { + valueOf: function() { + callCount += 1; + return sym; + }, + toString: null +}; + +obj[sym] = 0; + +assert.sameValue( + Object.hasOwn(obj, wrapper), + true, + "Returns true if symbol own property found" +); + +assert.sameValue(callCount, 1, "valueOf method called exactly once"); diff --git a/test/built-ins/Object/hasOwn/toobject_before_topropertykey.js b/test/built-ins/Object/hasOwn/toobject_before_topropertykey.js new file mode 100644 index 0000000000..b38d6c8961 --- /dev/null +++ b/test/built-ins/Object/hasOwn/toobject_before_topropertykey.js @@ -0,0 +1,48 @@ +// Copyright (C) 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-object.hasown +description: > + ToObject is performed before ToPropertyKey. +info: | + Object.hasOwn ( _O_, _P_ ) + + 1. Let _obj_ be ? ToObject(_O_). + 2. Let _key_ be ? ToPropertyKey(_P_). + + ToPropertyKey ( argument ) + + 1. Let key be ? ToPrimitive(argument, hint String). +author: Jamie Kyle +features: [Symbol.toPrimitive, Object.hasOwn] +---*/ + +var callCount1 = 0; +var coercibleKey1 = { + get toString() { + callCount1++; + throw new Test262Error(); + }, + get valueOf() { + callCount1++; + throw new Test262Error(); + }, +}; + +assert.throws(TypeError, function() { + Object.hasOwn(null, coercibleKey1); +}); +assert.sameValue(callCount1, 0, "toString and valueOf must not be called"); + + +var callCount2 = 0; +var coercibleKey2 = {}; +coercibleKey2[Symbol.toPrimitive] = function() { + callCount2++; + throw new Test262Error(); +}; + +assert.throws(TypeError, function() { + Object.hasOwn(undefined, coercibleKey2); +}); +assert.sameValue(callCount2, 0, "Symbol.toPrimitive must not be called"); diff --git a/test/built-ins/Object/hasOwn/toobject_null.js b/test/built-ins/Object/hasOwn/toobject_null.js new file mode 100644 index 0000000000..41e5f3dc8b --- /dev/null +++ b/test/built-ins/Object/hasOwn/toobject_null.js @@ -0,0 +1,15 @@ +// Copyright 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Let O be the result of calling ToObject passing the this value as + the argument. +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +assert.throws(TypeError, function() { + Object.hasOwn(null, 'foo'); +}); diff --git a/test/built-ins/Object/hasOwn/toobject_undefined.js b/test/built-ins/Object/hasOwn/toobject_undefined.js new file mode 100644 index 0000000000..a2cd777175 --- /dev/null +++ b/test/built-ins/Object/hasOwn/toobject_undefined.js @@ -0,0 +1,15 @@ +// Copyright 2021 Jamie Kyle. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.hasown +description: > + Let O be the result of calling ToObject passing the this value as + the argument. +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +assert.throws(TypeError, function() { + Object.hasOwn(undefined, 'foo'); +});