diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Object/hasOwn | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Object/hasOwn')
64 files changed, 1482 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/browser.js b/js/src/tests/test262/built-ins/Object/hasOwn/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/browser.js diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/descriptor.js b/js/src/tests/test262/built-ins/Object/hasOwn/descriptor.js new file mode 100644 index 0000000000..105e9eaa10 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/descriptor.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: Testing descriptor property of Object.hasOwn +includes: [propertyHelper.js] +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +verifyWritable(Object, "hasOwn"); +verifyNotEnumerable(Object, "hasOwn"); +verifyConfigurable(Object, "hasOwn"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown.js new file mode 100644 index 0000000000..5f0587e3bb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown.js @@ -0,0 +1,21 @@ +// 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')); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_exists.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_exists.js new file mode 100644 index 0000000000..eefc438f7c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_exists.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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter.js new file mode 100644 index 0000000000..9fff68d638 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter.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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter.js new file mode 100644 index 0000000000..389a0b432b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter.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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_enumerable.js new file mode 100644 index 0000000000..7008fb123f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_enumerable.js @@ -0,0 +1,27 @@ +// 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_nonenumerable.js new file mode 100644 index 0000000000..544ef19bde --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_configurable_nonenumerable.js @@ -0,0 +1,26 @@ +// 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..651f64075b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_enumerable.js @@ -0,0 +1,26 @@ +// 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..e990298d9f --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_and_setter_nonconfigurable_nonenumerable.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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_enumerable.js new file mode 100644 index 0000000000..7be3fc00a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_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 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_configurable_nonenumerable.js new file mode 100644 index 0000000000..b32db7f3a6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_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 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..4f8e2c20f6 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_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 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..e5d79ec8d3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_getter_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 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_enumerable.js new file mode 100644 index 0000000000..f6a04d85fc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_configurable_nonenumerable.js new file mode 100644 index 0000000000..87e13e833d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..3ebdb438f9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_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-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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..97de4fe45c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_nonwritable_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-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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter.js new file mode 100644 index 0000000000..aee60cc1d7 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter.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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_enumerable.js new file mode 100644 index 0000000000..0abbf08d4a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_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 + 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter_configurable_nonenumerable.js new file mode 100644 index 0000000000..01036b8b84 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_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 + 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..6c4a6339ed --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_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 + 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_setter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..dc1f127609 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_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 + 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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_enumerable.js new file mode 100644 index 0000000000..b23947cc53 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_configurable_nonenumerable.js new file mode 100644 index 0000000000..629e5d0fe8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..7f0d8c3cda --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..2dd98d90fe --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_inherited_writable_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]] (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")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_nonexistent.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_nonexistent.js new file mode 100644 index 0000000000..6d6c4b0d4c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_nonexistent.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]] (property does not exist) +author: Jamie Kyle +features: [Object.hasOwn] +---*/ + +var o = {}; + +assert.sameValue(Object.hasOwn(o, "foo"), false, 'Object.hasOwn(o, "foo")'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter.js new file mode 100644 index 0000000000..6f67785d83 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter.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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter.js new file mode 100644 index 0000000000..e23f79d7c4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter.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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_enumerable.js new file mode 100644 index 0000000000..8b17cbb95d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_enumerable.js @@ -0,0 +1,26 @@ +// 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_nonenumerable.js new file mode 100644 index 0000000000..6c578d2ab2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_configurable_nonenumerable.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, 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..4732f5bc17 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..aa3534ae89 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_and_setter_nonconfigurable_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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_configurable_enumerable.js new file mode 100644 index 0000000000..96e151f048 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_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 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_configurable_nonenumerable.js new file mode 100644 index 0000000000..7e91b1357c --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_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 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..de0bf03326 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_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 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..84b3e1c195 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_getter_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 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwritable_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwritable_configurable_enumerable.js new file mode 100644 index 0000000000..dc8e0031a4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwritable_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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwritable_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwritable_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..754097da1b --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwritable_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-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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwriteable_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwriteable_configurable_nonenumerable.js new file mode 100644 index 0000000000..36b7f14ccd --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwriteable_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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwriteable_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwriteable_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..f60bb35222 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_nonwriteable_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-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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_property_exists.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_property_exists.js new file mode 100644 index 0000000000..661d7804d4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_property_exists.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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter.js new file mode 100644 index 0000000000..94aa453182 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter.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 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_configurable_enumerable.js new file mode 100644 index 0000000000..09e650bb02 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_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 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_configurable_nonenumerable.js new file mode 100644 index 0000000000..322cb967c2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_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 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..3c8f500bfb --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_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 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..953fca4644 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_setter_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 + 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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_configurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_configurable_enumerable.js new file mode 100644 index 0000000000..e5e22be7e5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_configurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_configurable_nonenumerable.js new file mode 100644 index 0000000000..b759d497f3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_enumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_enumerable.js new file mode 100644 index 0000000000..31e4d6206d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_nonenumerable.js b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_nonconfigurable_nonenumerable.js new file mode 100644 index 0000000000..8684e398f5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/hasown_own_writable_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]] (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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/length.js b/js/src/tests/test262/built-ins/Object/hasOwn/length.js new file mode 100644 index 0000000000..9e8b586ce1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/length.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-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, +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/name.js b/js/src/tests/test262/built-ins/Object/hasOwn/name.js new file mode 100644 index 0000000000..c8532bc559 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/name.js @@ -0,0 +1,30 @@ +// 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"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/not-a-constructor.js b/js/src/tests/test262/built-ins/Object/hasOwn/not-a-constructor.js new file mode 100644 index 0000000000..a3badb6c87 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/not-a-constructor.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-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'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/prototype.js b/js/src/tests/test262/built-ins/Object/hasOwn/prototype.js new file mode 100644 index 0000000000..1eb3676ddc --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/prototype.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 +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); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/shell.js b/js/src/tests/test262/built-ins/Object/hasOwn/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/shell.js diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/symbol_own_property.js b/js/src/tests/test262/built-ins/Object/hasOwn/symbol_own_property.js new file mode 100644 index 0000000000..49146009fa --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/symbol_own_property.js @@ -0,0 +1,34 @@ +// 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" +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_toPrimitive.js b/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_toPrimitive.js new file mode 100644 index 0000000000..76260149d8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_toPrimitive.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 @@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"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_toString.js b/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_toString.js new file mode 100644 index 0000000000..e27def6e27 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_toString.js @@ -0,0 +1,41 @@ +// 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"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_valueOf.js b/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_valueOf.js new file mode 100644 index 0000000000..fd7f2b589d --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/symbol_property_valueOf.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 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"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/toobject_before_topropertykey.js b/js/src/tests/test262/built-ins/Object/hasOwn/toobject_before_topropertykey.js new file mode 100644 index 0000000000..6552617f03 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/toobject_before_topropertykey.js @@ -0,0 +1,50 @@ +// 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"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/toobject_null.js b/js/src/tests/test262/built-ins/Object/hasOwn/toobject_null.js new file mode 100644 index 0000000000..b9cf662835 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/toobject_null.js @@ -0,0 +1,17 @@ +// 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'); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Object/hasOwn/toobject_undefined.js b/js/src/tests/test262/built-ins/Object/hasOwn/toobject_undefined.js new file mode 100644 index 0000000000..070ba2d6af --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/hasOwn/toobject_undefined.js @@ -0,0 +1,17 @@ +// 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'); +}); + +reportCompare(0, 0); |