1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00
serenity/Libraries/LibJS/Tests
Matthew Olsson 5ae9419a06 LibJS: Object index properties have descriptors; Handle sparse indices
This patch adds an IndexedProperties object for storing indexed
properties within an Object. This accomplishes two goals: indexed
properties now have an associated descriptor, and objects now gracefully
handle sparse properties.

The IndexedProperties class is a wrapper around two other classes, one
for simple indexed properties storage, and one for general indexed
property storage. Simple indexed property storage is the common-case,
and is simply a vector of properties which all have attributes of
default_attributes (writable, enumerable, and configurable).

General indexed property storage is for a collection of indexed
properties where EITHER one or more properties have attributes other
than default_attributes OR there is a property with a large index (in
particular, large is '200' or higher).

Indexed properties are now treated relatively the same as storage within
the various Object methods. Additionally, there is a custom iterator
class for IndexedProperties which makes iteration easy. The iterator
skips empty values by default, but can be configured otherwise.
Likewise, it evaluates getters by default, but can be set not to.
2020-05-28 17:17:13 +02:00
..
add-values-to-primitive.js LibJS: Adding two values should convert them to primitives first 2020-04-15 09:48:25 +02:00
array-basic.js LibJS: Object index properties have descriptors; Handle sparse indices 2020-05-28 17:17:13 +02:00
array-length-setter.js LibJS: Implement Array length setter 2020-04-23 09:47:23 +02:00
array-shrink-during-find-crash.js LibJS: Call Array.prototype.findIndex() callback for empty elements 2020-04-28 20:15:38 +02:00
array-spread.js LibJS: Add side-effect-free version of Value::to_string() 2020-05-15 13:50:42 +02:00
Array.isArray.js LibJS: Add Array.isArray() 2020-05-08 20:06:49 +02:00
Array.js LibJS: Object index properties have descriptors; Handle sparse indices 2020-05-28 17:17:13 +02:00
Array.of.js LibJS: Object index properties have descriptors; Handle sparse indices 2020-05-28 17:17:13 +02:00
Array.prototype-generic-functions.js LibJS: Add Array.prototype.splice 2020-05-26 12:47:11 +02:00
Array.prototype.concat.js LibJS: Add Array.prototype.concat 2020-04-17 16:14:28 +02:00
Array.prototype.every.js LibJS: Add Array.prototype.every 2020-05-21 19:44:59 +02:00
Array.prototype.fill.js LibJS: Add Array.prototype.fill 2020-05-26 20:34:44 +02:00
Array.prototype.filter.js LibJS: Add assertThrowsError() test function 2020-04-20 11:38:01 +02:00
Array.prototype.find.js LibJS: Call Array.prototype.find() callback for empty elements 2020-04-28 20:15:38 +02:00
Array.prototype.findIndex.js LibJS: Call Array.prototype.findIndex() callback for empty elements 2020-04-28 20:15:38 +02:00
Array.prototype.forEach.js LibJS: Add assertThrowsError() test function 2020-04-20 11:38:01 +02:00
Array.prototype.includes.js LibJS: Treat missing arg in Array.prototype.includes() as undefined 2020-05-21 22:50:14 +02:00
Array.prototype.indexOf.js LibJS: Treat missing arg in Array.prototype.{indexOf,lastIndexOf}() as undefined 2020-05-23 00:02:13 +02:00
Array.prototype.join.js LibJS: Let Array.prototype.join() ignore additional arguments 2020-05-22 17:43:44 +02:00
Array.prototype.lastIndexOf.js LibJS: Fix Array.prototype.lastIndexOf() implementation 2020-05-23 00:02:13 +02:00
Array.prototype.map.js LibJS: Let Array.prototype.map() resize new array before loop 2020-04-28 20:15:38 +02:00
Array.prototype.pop.js LibJS: Return undefined in Array.prototype.{pop,shift} for empty values 2020-04-29 09:38:25 +02:00
Array.prototype.push.js LibJS: Support multiple arguments in Array.prototype.push() 2020-04-14 13:40:04 +02:00
Array.prototype.reduce.js LibJS: Add Array.prototype.reduce() (#2334) 2020-05-23 16:41:25 +02:00
Array.prototype.reduceRight.js LibJS: add Array.prototype.reduceRight() 2020-05-24 20:58:14 +02:00
Array.prototype.reverse.js LibJS: Add Array.prototype.reverse 2020-04-20 17:26:46 +02:00
Array.prototype.shift.js LibJS: Return undefined in Array.prototype.{pop,shift} for empty values 2020-04-29 09:38:25 +02:00
Array.prototype.slice.js LibJS: Add Array.prototype.slice 2020-04-19 02:09:06 +02:00
Array.prototype.some.js LibJS: Add Array.prototype.some 2020-04-28 13:11:10 +02:00
Array.prototype.splice.js LibJS: Add Array.prototype.splice 2020-05-26 12:47:11 +02:00
Array.prototype.toString.js LibJS: Skip undefined and null in join_array_with_separator() 2020-04-29 01:30:59 +02:00
Array.prototype.unshift.js LibJS: Add Array.prototype.unshift() 2020-04-14 13:40:04 +02:00
arrow-functions.js LibJS: Disallow multiple parameters in paren-less arrow function 2020-05-22 00:50:57 +02:00
assignment-operators.js LibJS: Implement modulo assignment operator (%=) 2020-05-05 11:12:27 +02:00
automatic-semicolon-insertion.js LibJS: Fix parsing of IfStatement, fixes #1829 2020-04-18 14:04:24 +02:00
binary-bitwise-left-shift.js LibJS: Implement bitwise left shift operator (<<) 2020-04-23 19:38:13 +02:00
binary-bitwise-or.js LibJS: Implement bitwise left shift operator (<<) 2020-04-23 19:38:13 +02:00
binary-bitwise-right-shift.js LibJS: Implement bitwise right shift operator (>>) 2020-04-23 19:38:13 +02:00
binary-bitwise-unsigned-right-shift.js LibJS: Implement bitwise unsigned right shift operator (>>>) 2020-04-23 19:38:13 +02:00
Boolean.js LibJS: Add "name" property to functions 2020-05-02 20:41:31 +02:00
Boolean.prototype.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Boolean.prototype.toString.js LibJS: Add assertThrowsError() test function 2020-04-20 11:38:01 +02:00
Boolean.prototype.valueOf.js LibJS: Add assertThrowsError() test function 2020-04-20 11:38:01 +02:00
comma-operator.js LibJS: Parse comma operator into SequenceExpression 2020-05-11 18:36:28 +02:00
comments-basic.js LibJS: Add missing load("test-common.js") to comments-basic.js 2020-04-14 17:26:57 +02:00
constructor-basic.js LibJS: Implement basic support for the "new" keyword 2020-03-28 16:33:52 +01:00
continue-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.js LibJS: Add "name" property to functions 2020-05-02 20:41:31 +02:00
Date.now.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getDate.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getDay.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getFullYear.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getHours.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getMilliseconds.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getMinutes.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getMonth.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getSeconds.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Date.prototype.getTime.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
debugger-statement.js LibJS: Implement (no-op) debugger statement 2020-05-01 22:07:13 +02:00
delete-basic.js LibJS: Implement basic support for the "delete" operator 2020-04-26 15:51:07 +02:00
delete-global-variable.js LibJS: Allow "delete someGlobalVariable" 2020-04-28 15:07:08 +02:00
delete-globalThis-property-crash.js LibJS: Grow storage when adding a property to uniquely-shaped Object 2020-04-26 19:05:08 +02:00
do-while-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
empty-statements.js LibJS: Support empty statements 2020-05-03 12:57:48 +02:00
Error.js LibJS: Add "name" property to functions 2020-05-02 20:41:31 +02:00
Error.prototype.name.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Error.prototype.toString.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
exception-ReferenceError.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
exponentiation-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
for-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
for-head-errors.js LibJS: Handle exception in for loop test execution 2020-04-28 23:11:18 +02:00
for-in-basic.js LibJS: Implement basic for..in and for..of loops 2020-05-25 18:45:36 +02:00
for-no-curlies.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
for-of-basic.js LibJS: Implement basic for..in and for..of loops 2020-05-25 18:45:36 +02:00
for-scopes.js LibJS: Limit scope of 'for' loop variables 2020-05-07 23:31:49 +02:00
function-default-parameters.js LibJS: Add function default arguments 2020-05-03 00:44:57 +02:00
function-length.js LibJS: Function.length respects default and rest parameters 2020-05-06 17:40:56 +02:00
function-missing-arg.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
function-name.js LibJS: Set name of anonymous functions during assignment 2020-05-03 11:41:56 +02:00
function-rest-params.js LibJS: Implement rest parameters 2020-05-04 23:30:52 +02:00
function-spread.js LibJS: Add function call spreading 2020-05-06 19:19:02 +02:00
function-this-in-arguments.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
function-TypeError.js LibJS: Add side-effect-free version of Value::to_string() 2020-05-15 13:50:42 +02:00
Function.js LibJS: Let parser keep track of errors 2020-05-15 09:53:52 +02:00
Function.prototype.apply.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Function.prototype.bind.js LibJS: Implement Function.prototype.bind() 2020-04-21 12:23:07 +02:00
Function.prototype.call.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Function.prototype.toString.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
in-operator-basic.js LibJS: Implement 'in' operator 2020-04-23 19:38:13 +02:00
indexed-access-string-object.js LibJS: Implement indexed access for StringObject 2020-05-01 16:54:01 +02:00
Infinity-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
instanceof-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
invalid-lhs-in-assignment.js LibJS: Check AssignmentExpression LHS in parser 2020-05-13 01:15:29 +02:00
isFinite.js LibJS: Implement Number.isFinite() 2020-04-26 20:36:59 +02:00
isNaN.js LibJS: Let isNaN() with no argument return true, add tests 2020-04-23 11:03:42 +02:00
let-scoping.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
logical-expressions-basic.js LibJS: Implement nullish coalescing operator (??) 2020-04-18 12:34:13 +02:00
logical-expressions-short-circuit.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math-constants.js LibJS: Add Math.exp() 2020-05-18 17:57:28 +02:00
Math.abs.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math.ceil.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math.clz32.js LibJS: Add Math.clz32() 2020-05-18 17:57:28 +02:00
Math.cos.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math.exp.js LibJS: Add Math.exp() 2020-05-18 17:57:28 +02:00
Math.expm1.js LibJS: Add Math.expm1() 2020-05-18 17:57:28 +02:00
Math.floor.js LibM: Fix floor() and floorf() for negative numbers 2020-05-15 22:05:59 +02:00
Math.max.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math.min.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math.pow.js LibJS: Add Math.pow() 2020-04-23 19:38:13 +02:00
Math.sign.js LibJS: Add Math.sign() 2020-05-18 17:57:28 +02:00
Math.sin.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math.sqrt.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math.tan.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Math.trunc.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
modulo-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
NaN-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Number-constants.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Number.isFinite.js LibJS: Add Number.parseFloat() 2020-05-17 16:21:38 +02:00
Number.isInteger.js LibJS: Make Number.isInteger() test pass on Serenity 2020-04-28 14:49:43 +02:00
Number.isNaN.js LibJS: Add Number.parseFloat() 2020-05-17 16:21:38 +02:00
Number.isSafeInteger.js LibJS: Implement Number.isFinite() 2020-04-26 20:36:59 +02:00
Number.js LibJS: Add "name" property to functions 2020-05-02 20:41:31 +02:00
Number.parseFloat.js LibJS: Add Number.parseFloat() 2020-05-17 16:21:38 +02:00
Number.prototype.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
numeric-literals-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
object-basic.js LibJS: Implement computed properties in object expressions 2020-04-23 23:56:04 +02:00
object-getter-setter-shorthand.js LibJS: Add object literal getter/setter shorthand 2020-05-22 10:59:05 +02:00
object-method-shorthand.js LibJS: Add object literal method shorthand 2020-05-01 12:28:40 +02:00
object-spread.js LibJS: Add spreading in object literals 2020-04-28 20:37:21 +02:00
Object.defineProperty.js LibJS: Object index properties have descriptors; Handle sparse indices 2020-05-28 17:17:13 +02:00
Object.entries.js LibJS: Add Object.{keys,values,entries}() 2020-04-30 09:53:16 +02:00
Object.getOwnPropertyNames.js LibJS: Implement correct object property ordering 2020-04-29 18:47:03 +02:00
Object.getPrototypeOf.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Object.is.js LibJS: Implement Object.is() 2020-04-26 13:53:05 +02:00
Object.js LibJS: Add "name" property to functions 2020-05-02 20:41:31 +02:00
Object.keys.js LibJS: Add Object.{keys,values,entries}() 2020-04-30 09:53:16 +02:00
Object.prototype.constructor.js LibJS: Make Object.prototype.constructor non-enumerable 2020-05-16 21:22:34 +02:00
Object.prototype.hasOwnProperty.js LibJS: Handle Object.prototype.hasOwnProperty() with no arg correctly 2020-04-28 20:03:50 +02:00
Object.prototype.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Object.prototype.toString.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Object.values.js LibJS: Add Object.{keys,values,entries}() 2020-04-30 09:53:16 +02:00
parseFloat.js LibJS: Add parseFloat() 2020-05-17 16:21:33 +02:00
parser-unary-associativity.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Reflect.apply.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.construct.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.defineProperty.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.deleteProperty.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.get.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.getOwnPropertyDescriptor.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.getPrototypeOf.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.has.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.ownKeys.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.set.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
Reflect.setPrototypeOf.js LibJS: Implement most of the Reflect object 2020-05-01 16:54:01 +02:00
run-tests.sh Build: Switch to CMake :^) 2020-05-14 20:15:18 +02:00
string-escapes.js LibJS: Handle hex and unicode escape sequences in string literals 2020-05-18 17:58:17 +02:00
string-spread.js LibJS: Support spreading of strings and string objects 2020-04-28 15:35:24 +02:00
String.js LibJS: Add "name" property to functions 2020-05-02 20:41:31 +02:00
String.prototype-generic-functions.js LibJS: Make String.prototype.slice() generic 2020-04-29 19:14:36 +02:00
String.prototype.charAt.js LibJS: Treat NaN in Value::to_i32() as zero 2020-05-23 16:39:17 +02:00
String.prototype.concat.js LibJS: Add String.prototype.concat 2020-04-16 16:36:51 +02:00
String.prototype.includes.js LibJS: Add String.prototype.includes 2020-04-25 16:54:25 +02:00
String.prototype.indexOf.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
String.prototype.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
String.prototype.lastIndexOf.js LibJS: Add String.prototype.lastIndexOf 2020-05-01 16:50:37 +02:00
String.prototype.padEnd.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
String.prototype.padStart.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
String.prototype.repeat.js LibJS: Add tests for String.prototype.repeat() 2020-04-20 11:41:25 +02:00
String.prototype.slice.js LibJS: Add String.prototype.slice 2020-04-29 18:35:18 +02:00
String.prototype.startsWith.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
String.prototype.substring.js LibJS: Add String.prototype.substring 2020-04-16 18:47:24 +02:00
String.prototype.toLowerCase.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
String.prototype.toString.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
String.prototype.toUpperCase.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
String.prototype.trim.js LibJS: Add String.prototype.{trim, trimStart, trimEnd} (#1792) 2020-04-15 08:47:40 +02:00
String.raw.js LibJS: Add String.raw 2020-05-07 23:05:55 +02:00
switch-basic-2.js LibJS: Use assertNotReached() in tests 2020-04-13 16:28:50 +02:00
switch-basic-3.js LibJS: Fix test files indentation (4 spaces) 2020-04-13 16:28:50 +02:00
switch-basic.js LibJS: Spec-compliant equality comparisons 2020-05-08 09:49:20 +02:00
switch-break.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
Symbol.for.js LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
Symbol.js LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
Symbol.keyFor.js LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
Symbol.prototype.toString.js LibJS: Throw TypeError when coercing symbol to number 2020-05-18 09:39:55 +02:00
Symbol.prototype.valueOf.js LibJS: Add symbol objects 2020-05-17 18:05:15 +02:00
tagged-template-literals.js LibJS: Add raw strings to tagged template literals 2020-05-07 23:05:55 +02:00
template-literals.js LibJS: Add template literals 2020-05-04 16:46:31 +02:00
ternary-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
test-common.js LibJS: Add Array.prototype.fill 2020-05-26 20:34:44 +02:00
throw-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
to-number-basic.js LibJS: Trim whitespace from string before coercing to number 2020-05-13 09:36:20 +02:00
to-number-exception.js LibJS: Pass Interpreter& to Value::to_number() et al. 2020-05-18 09:39:55 +02:00
typeof-basic.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
update-expression-on-member-expression.js LibJS: Support o.f++ :^) 2020-04-28 15:07:08 +02:00
update-expressions-basic.js LibJS: Improve UpdateExpression::execute() 2020-04-22 13:09:59 +02:00
var-multiple-declarator.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
var-scoping.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
variable-declaration.js LibJS: Add assertThrowsError() test function 2020-04-20 11:38:01 +02:00
variable-undefined.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +02:00
void-basic.js LibJS: Implement void operator 2020-04-15 19:12:51 +02:00
while-basic.js LibJS: Parse while statements 2020-04-22 11:48:14 +02:00