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/language/statements/class/subclass/builtin-objects/Array/length.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/language/statements/class/subclass/builtin-objects/Array/length.js')
-rw-r--r-- | js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js new file mode 100644 index 0000000000..e19bc322a6 --- /dev/null +++ b/js/src/tests/test262/language/statements/class/subclass/builtin-objects/Array/length.js @@ -0,0 +1,38 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 22.1.4.1 +description: > + Instances has the own property length +info: | + 22.1.4.1 length + + The length property of an Array instance is a data property whose value is + always numerically greater than the name of every configurable own property + whose name is an array index. + + The length property initially has the attributes { [[Writable]]: true, + [[Enumerable]]: false, [[Configurable]]: false }. +---*/ + +class Ar extends Array {} + +var arr = new Ar('foo', 'bar'); + +assert.sameValue(arr[0], 'foo'); +assert.sameValue(arr[1], 'bar'); + +var arrDesc = Object.getOwnPropertyDescriptor(arr, 'length'); + +assert.sameValue(arrDesc.writable, true); +assert.sameValue(arrDesc.enumerable, false); +assert.sameValue(arrDesc.configurable, false); + +assert.sameValue(arr[1], 'bar'); + +arr.length = 1; + +assert.sameValue(arr[0], 'foo'); +assert.sameValue(arr[1], undefined); + +reportCompare(0, 0); |