Nico Weber
248b79d687
LibJS: Add FIXMEs to a few functions that need UTF-16 handling
2020-07-22 17:26:34 +02:00
Nico Weber
979e02c0a8
LibJS: Implement String.prototype.charCodeAt
...
It's broken for strings with characters outside 7-bit ASCII, but
it's broken in the same way as several existing functions (e.g.
charAt()), so that's probably ok for now.
2020-07-22 15:48:01 +02:00
Matthew Olsson
02305d01ea
LibJS: Add Number.prototype.toString
2020-07-15 18:24:55 +02:00
Matthew Olsson
6075defd55
LibJS: Add Symbol.hasInstance tests
2020-07-14 20:15:19 +02:00
Matthew Olsson
b0296735a5
LibJS: Implement Symbol.hasInstance
2020-07-14 20:15:19 +02:00
Matthew Olsson
dd49ec17a2
LibJS: Implement spec-complient instance_of operation
2020-07-14 20:15:19 +02:00
Matthew Olsson
a51b2393f2
LibJS: Integrate iterator protocol into language features
...
Finally use Symbol.iterator protocol in language features :) currently
only used in for-of loops and spread expressions, but will have more
uses later (Maps, Sets, Array.from, etc).
2020-07-14 17:58:42 +02:00
Matthew Olsson
4c3a415dc3
LibJS: Add String Iterator tests
2020-07-13 15:07:29 +02:00
Matthew Olsson
c831fb17bf
LibJS: Add StringIterator
2020-07-13 15:07:29 +02:00
Matthew Olsson
43d955014d
LibJS: Implement Symbol.toStringTag
2020-07-11 23:13:29 +02:00
Matthew Olsson
5ecd504f4e
LibJS: Implement spec-compliant Object.prototype.toString
2020-07-11 23:13:29 +02:00
Matthew Olsson
531fdb2e82
LibJS: Prefer "define_property" over "put"
2020-07-11 18:54:13 +02:00
Matthew Olsson
c485c86015
LibJS: Use macros to enumerate well-known symbols
...
Not only is this a much nicer api (can't pass a typo'd string into the
get_well_known_symbol function), it is also a bit more performant since
there are no hashmap lookups.
2020-07-11 18:54:13 +02:00
Matthew Olsson
2ea85355fe
LibJS: Start implementing iterable framework, add ArrayIterator
...
With the addition of symbol keys, work can now be done on starting to
implement the well-known symbol functionality. The most important of
these well-known symbols is by far Symbol.iterator.
This patch adds IteratorPrototype, as well as ArrayIterator and
ArrayIteratorPrototype. In the future, sometime after StringIterator has
also been added, this will allow us to use Symbol.iterator directly in
for..of loops, enabling the use of custom iterator objects. Also makes
adding iterator support to native objects much easier (as will have to
be done for Map and Set, when they get added).
2020-07-11 18:54:13 +02:00
Matthew Olsson
51bfc6c6b3
LibJS: Renamed Object::GetOwnPropertyReturnMode to Object::PropertyKind
...
This enum will be used by iterators, so it makes sense to use a more
general name.
2020-07-11 18:54:13 +02:00
Linus Groh
7241b9ca0c
LibJS: Remove a few superfluous exception checks
...
We don't need to check for exceptions when defining properties on an
array we literally created ourselves a few lines earlier.
2020-07-11 18:38:51 +02:00
Matthew Olsson
119386ffb0
LibJS: Add tests for symbol object integration
2020-07-09 23:33:00 +02:00
Matthew Olsson
7a1d485b19
LibJS: Integrate Symbols into objects as valid keys
...
This allows objects properties to be created for symbol keys in addition
to just plain strings/numbers
2020-07-09 23:33:00 +02:00
Matthew Olsson
9783a4936c
LibJS: Add test for well-known symbols
2020-07-09 23:29:28 +02:00
Matthew Olsson
ffb569fd5d
LibJS: Uncomment remaining symbol tests
2020-07-09 23:29:28 +02:00
Matthew Olsson
d9db6bec42
LibJS: Move global symbol map from SymbolObject to Interpreter
...
This allows different instances of the Interpreter to have their own
global symbols. Also makes Symbol non-copyable and non-moveable.
2020-07-09 23:29:28 +02:00
Matthew Olsson
93ebd320ef
LibJS: Object.preventExtensions should allow property modfication
...
Existing properties on a non-extensible object should be changable and
deletable.
2020-07-07 10:47:10 +02:00
Linus Groh
461d90d042
LibJS: Convert Array tests to new testing framework
2020-07-06 23:40:35 +02:00
Linus Groh
8ebdf685a6
LibJS: Split isNaN tests into multiple sections
2020-07-06 23:40:35 +02:00
Matthew Olsson
1ef573eb30
LibJS: Indent tests with 4 spaces instead of 2
2020-07-06 23:40:35 +02:00
Matthew Olsson
15de2eda2b
LibJS: Convert all remaining non-Array tests to the new system :)
2020-07-06 23:40:35 +02:00
Matthew Olsson
918f4affd5
LibJS: Convert remaining top-level tests to new system
2020-07-06 23:40:35 +02:00
Matthew Olsson
6d58c48c2f
test-js: Use prettier and format all files
2020-07-06 23:40:35 +02:00
Matthew Olsson
a2dbd955f2
test-js: Display messages from console.log in test output
...
This will help greatly with debugging!
2020-07-06 23:40:35 +02:00
Matthew Olsson
82fa65135a
test-js: Allow skipping tests with "test.skip(name, callback)"
...
Skipped tests count as a "pass" rather than a "fail" (i.e. a test suite
with a skipped test will pass), however it does display a message when
the test is printing.
This is intended for tests which _should_ work, but currently do not.
This should be preferred over "// FIXME" notes if possible.
2020-07-06 23:40:35 +02:00
Matthew Olsson
cf537311e4
test-js: Remove run-tests.sh
...
The shell script is no longer necessary -- simply run "test-js" from
inside Serenity, or $SERENITY_ROOT/Build/Meta/Lagom/test-js from the
host.
2020-07-06 23:40:35 +02:00
Matthew Olsson
26acc8ba88
LibJS/test-js: Clean up test-js code
...
This commit also exposes JSONObject's implementation of stringify to the
public, so that it can be used by test-js without having to go through
the interpreter's environment.
2020-07-06 23:40:35 +02:00
Matthew Olsson
4c6fd49169
LibJS: Fix String.raw.length
2020-07-06 23:40:35 +02:00
Matthew Olsson
3f97d75778
LibJS: Convert most builtin tests to new system
2020-07-06 23:40:35 +02:00
Linus Groh
46581773c1
LibJS: Convert Reflect object tests to new testing framework
2020-07-06 23:40:35 +02:00
Matthew Olsson
fc08222f46
LibJS: Add more test matchers
2020-07-06 23:40:35 +02:00
Matthew Olsson
5e971c91e3
LibJS: Hide some debug output behind flags
...
This hides some Object.cpp output, as well as removing the "debugger"
debug output.
2020-07-06 23:40:35 +02:00
Matthew Olsson
449a1cf3a2
LibJS: Convert Proxy tests
2020-07-06 23:40:35 +02:00
Matthew Olsson
b86faeaeef
LibJS: Add test-common.js tests, remove unused matchers
...
Now that test-common.js is quite a bit more complicated, we need tests
for test-common to make sure all of the matchers behave correctly
2020-07-06 23:40:35 +02:00
Matthew Olsson
eea6041302
LibJS: Convert some top-level tests to the new system
...
First test conversions! These look really good :)
2020-07-06 23:40:35 +02:00
Matthew Olsson
4b8a3e6d78
LibJS: Refactor run-tests.sh to use the new test-js program
2020-07-06 23:40:35 +02:00
Matthew Olsson
b9cf7a833f
LibJS/test-js: Create test-js program, prepare for test suite refactor
...
This moves most of the work from run-tests.sh to test-js.cpp. This way,
we have a lot more control over how the test suite runs, as well as how
it outputs. This should result in some cool functionality!
This commit also refactors test-common.js to mimic the jest library.
This should allow tests to be much more expressive :)
2020-07-06 23:40:35 +02:00
Matthew Olsson
6af3fff0c2
LibJS: Reformat run-tests.sh output
...
- Use emojis instead of the pass/fail text
- Fix the new version of the script to run inside Serenity
- Don't print erroneous output after 'Output:'; start on a newline
instead
- Skip 'run-tests.sh' while testing
2020-07-03 19:30:13 +02:00
Matthew Olsson
97634d0678
LibJS: Hide interpreter exception debug output behind a flag
2020-07-03 19:30:13 +02:00
Matthew Olsson
4c48c9d69d
LibJS: Reorganize tests into subfolders
2020-07-03 19:30:13 +02:00
Matthew Olsson
21064a1883
LibJS: Use correct MarkedValueList append method
2020-07-03 19:30:13 +02:00
Matthew Olsson
02debd8a6d
LibJS: Remove extra colon in run-tests.sh output
2020-07-03 19:30:13 +02:00
Matthew Olsson
bda39ef7ab
LibJS: Explicitly pass a "Function& new_target" to Function::construct
...
This allows the proxy handler to pass the proper new.target to construct
handlers.
2020-07-01 11:16:37 +02:00
Matthew Olsson
19411e22d0
LibJS: Add Proxy [[Call]] and [[Construct]] tests
2020-07-01 11:16:37 +02:00
Matthew Olsson
98323e19e5
LibJS: Implement Proxy [[Call]] and [[Construct]] traps
...
In order to do this, Proxy now extends Function rather than Object, and
whether or not it returns true for is_function() depends on it's
m_target.
2020-07-01 11:16:37 +02:00