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/assign/strings-and-symbol-order.js | |
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/assign/strings-and-symbol-order.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Object/assign/strings-and-symbol-order.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/assign/strings-and-symbol-order.js b/js/src/tests/test262/built-ins/Object/assign/strings-and-symbol-order.js new file mode 100644 index 0000000000..57cf13c377 --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/assign/strings-and-symbol-order.js @@ -0,0 +1,63 @@ +// Copyright (C) 2018 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.assign +description: > + Symbol-valued properties are copied after String-valued properties. +info: | + 19.1.2.1 Object.assign ( target, ...sources ) + + ... + 4. For each element nextSource of sources, in ascending index order, do + a. ... + b. Else, + i. Let from be ! ToObject(nextSource). + ii. Let keys be ? from.[[OwnPropertyKeys]](). + c. For each element nextKey of keys in List order, do + ... + ... + + 9.1.11.1 OrdinaryOwnPropertyKeys ( O ) + + ... + 3. For each own property key P of O that is a String but is not an integer index, + in ascending chronological order of property creation, do + a. Add P as the last element of keys. + 4. For each own property key P of O that is a Symbol, in ascending chronological + order of property creation, do + a. Add P as the last element of keys. + ... + +includes: [compareArray.js] +---*/ + +var log = []; + +var sym1 = Symbol("x"); +var sym2 = Symbol("y"); + +var source = {}; + +Object.defineProperty(source, sym1, { + get: function(){ log.push("get sym(x)") }, + enumerable: true, configurable: true, +}); +Object.defineProperty(source, "a", { + get: function(){ log.push("get a") }, + enumerable: true, configurable: true, +}); +Object.defineProperty(source, sym2, { + get: function(){ log.push("get sym(y)") }, + enumerable: true, configurable: true, +}); +Object.defineProperty(source, "b", { + get: function(){ log.push("get b") }, + enumerable: true, configurable: true, +}); + +var target = Object.assign({}, source); + +assert.compareArray(log, ["get a", "get b", "get sym(x)", "get sym(y)"]); + +reportCompare(0, 0); |