Jack Karamanian
1fa0c7304d
LibJS: Implement Function.prototype.bind()
2020-04-21 12:23:07 +02:00
Linus Groh
9722cac9fe
LibJS: Let run-tests return 1 when not all tests pass
2020-04-20 22:44:13 +02:00
Andreas Kling
f78a92c5a9
LibJS: Remove default parameter from assertThrowsError() for now
...
We don't support these yet, and it broke all the tests. :^)
2020-04-20 20:33:21 +02:00
Linus Groh
cff68af965
LibJS: Add JSDoc to test-common.js
2020-04-20 17:31:49 +02:00
Kesse Jones
df6696f576
LibJS: Add Array.prototype.reverse
2020-04-20 17:26:46 +02:00
Kesse Jones
579975fd1e
LibJS: Add Array.prototype.indexOf
2020-04-20 11:55:18 +02:00
Linus Groh
d3e3f5b421
LibJS: Add tests for String.prototype.repeat()
2020-04-20 11:41:25 +02:00
Linus Groh
0718f216af
LibJS: Add assertThrowsError() test function
2020-04-20 11:38:01 +02:00
Andreas Kling
69566bd4d6
LibJS: Allow passing "js" flags to run-tests
...
This allows us to run "run-tests -g" for testing with GC after every
heap allocation. This may flush out bugs that would otherwise not
occur if GC'ing only occasionally.
2020-04-19 17:34:33 +02:00
Andreas Kling
afdba94f63
LibJS: Fix expectations in the function-TypeError.js test
...
They now match the new, more verbose error messages.
2020-04-19 14:51:47 +02:00
Kesse Jones
856ab9c600
LibJS: Add Array.prototype.slice
2020-04-19 02:09:06 +02:00
Stephan Unverwerth
bf5b251684
LibJS: Allow reserved words as keys in object expressions.
2020-04-18 22:23:20 +02:00
Stephan Unverwerth
cebb619f8e
LibJS: Fix parsing of IfStatement, fixes #1829
2020-04-18 14:04:24 +02:00
Linus Groh
d14ddb6461
LibJS: Implement nullish coalescing operator (??)
2020-04-18 12:34:13 +02:00
Kesse Jones
4931c0feda
LibJS: Add Array.prototype.concat
2020-04-17 16:14:28 +02:00
Stephan Unverwerth
63e1ea7819
LibJS: Add test for semicolon insertion ( #1828 )
2020-04-17 15:52:38 +02:00
Kesse Jones
b0b204822f
LibJS: Add String.prototype.substring
2020-04-16 18:47:24 +02:00
Kesse Jones
7725b1970e
LibJS: Add String.prototype.concat
2020-04-16 16:36:51 +02:00
Linus Groh
640a24dce8
LibJS: Remove outdated FIXME now that we have lexical environments
2020-04-16 09:41:07 +02:00
Linus Groh
cea950fd70
LibJS: Support empty values in array expression
2020-04-15 21:23:06 +02:00
Linus Groh
d30db07048
LibJS: Implement void operator
2020-04-15 19:12:51 +02:00
Linus Groh
a8406aa117
LibJS: Check length property of Array.prototype.join in its test
...
I assume this was copied from the Array.prototype.push() test :^)
2020-04-15 12:20:08 +02:00
Andreas Kling
ad2aac5fde
LibJS: Add Array.prototype.join()
...
And share the code with Array.prototype.toString() :^)
2020-04-15 10:06:01 +02:00
Andreas Kling
fa30355194
LibJS: Adding two values should convert them to primitives first
2020-04-15 09:48:25 +02:00
Kesse Jones
994f1a79ad
LibJS: Add String.prototype.{trim, trimStart, trimEnd} ( #1792 )
2020-04-15 08:47:40 +02:00
Linus Groh
1dee4d0049
LibJS: Redirect stderr to /dev/null when running js in run-tests
...
This "mutes" output from dbg() calls - which is not an issue inside
serenity itself but if the script is run on the host machine and stdout
and stderr are displayed in the same terminal window.
2020-04-14 18:38:55 +02:00
Linus Groh
823fb9d9aa
LibJS: Add missing load("test-common.js") to comments-basic.js
...
This fixes the test which is currently failing with
"ReferenceError: 'assert' not known".
2020-04-14 17:26:57 +02:00
Linus Groh
f7df521073
LibJS: Add Array.prototype.map()
2020-04-14 13:40:04 +02:00
Linus Groh
f03d005bc4
LibJS: Add Array.prototype.filter()
2020-04-14 13:40:04 +02:00
Linus Groh
866172a721
LibJS: Add Array.prototype.forEach()
2020-04-14 13:40:04 +02:00
Linus Groh
29253bf932
LibJS: Add Array.prototype.unshift()
2020-04-14 13:40:04 +02:00
Linus Groh
5da1a40ccf
LibJS: Support multiple arguments in Array.prototype.push()
2020-04-14 13:40:04 +02:00
Brian Gianforcaro
d74ad81402
js/LibJS: Move test functions to pure javascript.
...
The addition of assert functions to Userland/js
was done before we had load(..) implemented. Now
that it exists, it seems like the right move the
test helper functions to pure javascript instead
of poluting js with random global functions.
2020-04-14 12:55:31 +02:00
Stephan Unverwerth
9477efe970
LibJS: Handle HTML-style comments
2020-04-14 12:54:09 +02:00
Stephan Unverwerth
8f82f6c574
LibJS: Add more number test cases for #1680
2020-04-13 17:23:22 +02:00
Andreas Kling
ac7459cb40
LibJS: Hoist variable declarations to the nearest relevant scope
...
"var" declarations are hoisted to the nearest function scope, while
"let" and "const" are hoisted to the nearest block scope.
This is done by the parser, which keeps two scope stacks, one stack
for the current var scope and one for the current let/const scope.
When the interpreter enters a scope, we walk all of the declarations
and insert them into the variable environment.
We don't support the temporal dead zone for let/const yet.
2020-04-13 17:22:23 +02:00
Linus Groh
b9415dc0e9
LibJS: Use assertNotReached() in tests
2020-04-13 16:28:50 +02:00
Linus Groh
92a9fe0e49
LibJS: Fix test files indentation (4 spaces)
2020-04-13 16:28:50 +02:00
Brian Gianforcaro
2a65db7c12
LibJS: Implement Error.prototype.name setter ( #1776 )
...
The MDN example for creating a custom error type in javascript uses:
function CustomError(foo, message, fileName, lineNumber) {
var instance = new Error(message, fileName, lineNumber);
instance.name = 'CustomError';
instance.foo = foo;
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
return instance;
}
The name property on the Error prototype needs to be settable for
this to work properly.
2020-04-13 11:19:53 +02:00
Stephan Unverwerth
bbd592cb6c
LibJS: Tweak FunctionPrototype::to_string and constructors
...
The output of FunctionPrototype::to_string is now more in line
with the output in Firefox. The builtin constructors have been
extended to include their function name in the output.
2020-04-13 01:14:21 +02:00
Brian Gianforcaro
0d41e542b7
LibJS: Throw on assignment of an const variable
...
Was stubbed out as an assert, should be handled with a runtime exception.
2020-04-13 01:12:31 +02:00
Linus Groh
f226746394
LibJS: Handle Infinity in Value::to_number()
2020-04-12 14:39:38 +02:00
4ourbit
02c9f4c951
LibJS: Improve Object.defineProperty test
2020-04-10 23:33:02 +02:00
Linus Groh
31505dde7e
LibJS: Add String.prototype.pad{Start,End}()
2020-04-10 16:37:04 +02:00
Linus Groh
7636dee2cb
LibJS: Remove assert function from Object.defineProperty() test
2020-04-10 16:37:04 +02:00
Linus Groh
0243ac5d04
LibJS: Remove mock String.prototype from tests
2020-04-10 15:51:39 +02:00
Linus Groh
32c27afdf0
LibJS: Add String.prototype.toString()
2020-04-10 15:49:40 +02:00
Andreas Kling
6f3ea75569
LibJS: Add String constructor :^)
2020-04-10 14:14:02 +02:00
Andreas Kling
070a8f2689
LibJS: Boolean, Number and String prototypes should have values too
...
It appears that calling .valueOf() on an objectified primitive's
prototype should return a value after all.
This matches what other engines are doing.
2020-04-10 13:09:35 +02:00
Barney Wilks
4f48fcdb94
LibJS: Add tests for exception if assignment LHS is invalid
2020-04-10 11:27:10 +02:00