1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +00:00
serenity/Libraries/LibJS/Tests
Yonatan Goldschmidt b184f12aaf LibJS: Limit scope of 'for' loop variables
This required 2 changes:
1. In the parser, create a new variable scope, so the variable is
   declared in it instead of the scope in which the 'for' is found.
2. On execute, push the variable into the newly created block. Existing
   code created an empty block (no variables, no arguments) which
   allows Interpreter::enter_scope() to skip the creation of a new
   environment, therefore when the variable initializer is executed, it
   sets the variable to the outer scope. By attaching the variable to
   the new block, the block gets a new environment.

This is only needed for 'let' / 'const' declarations, since 'var'
declarations are expected to leak.

Fixes: #2103
2020-05-07 23:31:49 +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: Support empty values in array expression 2020-04-15 21:23:06 +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: Support spreading of strings and string objects 2020-04-28 15:35:24 +02:00
Array.js LibJS: Add "name" property to functions 2020-05-02 20:41:31 +02:00
Array.prototype.concat.js LibJS: Add Array.prototype.concat 2020-04-17 16:14:28 +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: Add Array.prototype.includes 2020-04-23 19:30:16 +02:00
Array.prototype.indexOf.js LibJS: Fix Array.prototype.indexOf fromIndex negative 2020-04-23 11:06:10 +02:00
Array.prototype.join.js LibJS: Skip undefined and null in join_array_with_separator() 2020-04-29 01:30:59 +02:00
Array.prototype.lastIndexOf.js LibJS: Add Array.prototype.lastIndexOf 2020-04-22 13:08:00 +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.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.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: Fix syntax error for arrow function non-decl variable assignment 2020-05-06 12:21:29 +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
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-no-curlies.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +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 assertThrowsError() test function 2020-04-20 11:38:01 +02:00
Function.js LibJS: Add "name" property to functions 2020-05-02 20:41:31 +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: Add assertThrowsError() test function 2020-04-20 11:38:01 +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 js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +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.cos.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +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.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: Implement Number.isFinite() 2020-04-26 20:36:59 +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: Implement Number.isNaN() 2020-04-26 20:36:59 +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.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-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: Add assertThrowsError() test function 2020-04-20 11:38:01 +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 js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +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
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 LibJS: Fix shellcheck warnings in Tests/run-tests 2020-05-07 12:20:41 +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 js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +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: Fix test files indentation (4 spaces) 2020-04-13 16:28:50 +02:00
switch-break.js js/LibJS: Move test functions to pure javascript. 2020-04-14 12:55:31 +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: Remove default parameter from assertThrowsError() for now 2020-04-20 20:33:21 +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: Don't handle arrays separately in Value::to_number() 2020-04-29 01:30:59 +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