summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests
AgeCommit message (Collapse)Author
2020-07-06test-js: Use prettier and format all filesMatthew Olsson
2020-07-06test-js: Display messages from console.log in test outputMatthew Olsson
This will help greatly with debugging!
2020-07-06test-js: Allow skipping tests with "test.skip(name, callback)"Matthew Olsson
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-06test-js: Remove run-tests.shMatthew Olsson
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-06LibJS/test-js: Clean up test-js codeMatthew Olsson
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-06LibJS: Convert most builtin tests to new systemMatthew Olsson
2020-07-06LibJS: Convert Reflect object tests to new testing frameworkLinus Groh
2020-07-06LibJS: Add more test matchersMatthew Olsson
2020-07-06LibJS: Convert Proxy testsMatthew Olsson
2020-07-06LibJS: Add test-common.js tests, remove unused matchersMatthew Olsson
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-06LibJS: Convert some top-level tests to the new systemMatthew Olsson
First test conversions! These look really good :)
2020-07-06LibJS: Refactor run-tests.sh to use the new test-js programMatthew Olsson
2020-07-06LibJS/test-js: Create test-js program, prepare for test suite refactorMatthew Olsson
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-03LibJS: Reformat run-tests.sh outputMatthew Olsson
- 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-03LibJS: Reorganize tests into subfoldersMatthew Olsson
2020-07-03LibJS: Remove extra colon in run-tests.sh outputMatthew Olsson
2020-07-01LibJS: Explicitly pass a "Function& new_target" to Function::constructMatthew Olsson
This allows the proxy handler to pass the proper new.target to construct handlers.
2020-07-01LibJS: Add Proxy [[Call]] and [[Construct]] testsMatthew Olsson
2020-06-30LibJS: Skip some Math object tests that fail on SerenityAndreas Kling
Mark a bunch of these with FIXME so that someone can find them and fix them eventually. :^)
2020-06-29LibJS: Initial class implementation; allow super expressions in objectJack Karamanian
literal methods; add EnvrionmentRecord fields and methods to LexicalEnvironment Adding EnvrionmentRecord's fields and methods lets us throw an exception when |this| is not initialized, which occurs when the super constructor in a derived class has not yet been called, or when |this| has already been initialized (the super constructor was already called).
2020-06-29LibJS: Define the "constructor" property on ScriptFunction's prototypeJack Karamanian
and set it to the current function
2020-06-26LibJS: run-test.sh emits test output if it is not "PASS"Matthew Olsson
Previously, debugging a test with console.log statements was impossible, because it would just cause the test to fail with no additional output. Now, if the output of a test is not "PASS", the output will be printed under the line where the test failed. Empty output will have a special message attached to it -- useful when a test author has forgotten to include `console.log("PASS")` at the end of a test.
2020-06-25LibJS: Handle "receiver" argument in Reflect.{get,set}()Linus Groh
2020-06-22LibJS: expose some more math functionsstelar7
2020-06-13LibJS: Add JSON.parseMatthew Olsson
2020-06-13LibJS: Add JSON.stringifyMatthew Olsson
2020-06-11LibJS: Consolidate error messages into ErrorTypes.hMatthew Olsson
Now, exceptions can be thrown with interpreter.throw_exception<T>(ErrorType:TYPE, "format", "args", "here").
2020-06-07LibJS: Add BigIntLinus Groh
2020-06-06LibJS: Add Proxy objectsMatthew Olsson
Includes all traps except the following: [[Call]], [[Construct]], [[OwnPropertyKeys]]. An important implication of this commit is that any call to any virtual Object method has the potential to throw an exception. These methods were not checked in this commit -- a future commit will have to protect these various method calls throughout the codebase.
2020-06-06LibJS: Fix rest-params test to take function hoisting into accountMarcin Gasperowicz
2020-06-06LibJS: Hoist function declarationsMarcin Gasperowicz
This patch adds function declaration hoisting. The mechanism is similar to var hoisting. Hoisted function declarations are to be put before the hoisted var declarations, hence they have to be treated separately.
2020-06-03LibJS: Make typeof return undefined for undefined variablesMarcin Gasperowicz
This makes `typeof i_dont_exist` return `undefined` instead of throwing an error.
2020-06-03LibJS: Allow null or undefined as a bound |this| value in strict modeJack Karamanian
2020-06-02LibJS: Consider non-extensible objects in Reflect.setPrototypeOf()Linus Groh
2020-06-02LibJS: Implement Reflect.{isExtensible,preventExtensions}()Linus Groh
2020-06-02LibJS: Disallow changing the prototype of non-extensible objectsLinus Groh
Object::set_prototype() now returns a boolean indicating success. Setting the prototype to an identical object is always considered successful, even if the object is non-extensible.
2020-06-02LibJS: Don't assume Object.setPrototypeOf() prototype value is an objectLinus Groh
We're crashing otherwise. Also it was not possible to set the prototype to null.
2020-06-02LibJS: Return specified object from Object.setPrototypeOf()Linus Groh
We were leaking an empty value.
2020-06-02LibJS: Add Object.{isExtensible,preventExtensions}()Matthew Olsson
2020-06-01LibJS: Rewrite Parser.parse_object_expression()Matthew Olsson
This rewrite drastically increases the accuracy of object literals. Additionally, an "assertIsSyntaxError" function has been added to test-common.js to assist in testing syntax errors.
2020-05-31LibJS: Add String.fromCharCode()Linus Groh
2020-05-30LibJS: Show run-tests progress in the taskbarAndreas Kling
Use the window progress escape sequence to indicate how far along in the test collection we are while running tests. :^)
2020-05-30LibJS: Use a non-arrow function to check the |this| value in theJack Karamanian
callback for Array.prototype.{reduce,reduceRight} Arrow functions always retain the |this| binding. Running this code in Node: [1, 2].reduce(() => { "use strict"; console.log(this === undefined) } Output: false
2020-05-30LibJS: Add tests ensuring the |this| value can't be set for arrowJack Karamanian
functions in Function.prototype.{call,apply}
2020-05-30LibJS: Use the function's bound |this| and bound arguments inJack Karamanian
Interpreter::call()
2020-05-30LibJS: Throw a TypeError when an arrow function is used as a constructorJack Karamanian
2020-05-30LibJS: Don't define the "prototype" property for arrow functionsJack Karamanian
2020-05-30LibJS: Set the bound |this| value to the |this| value of the currentJack Karamanian
scope for arrow functions
2020-05-30LibJS: Object.getOwnPropertyDescriptor works properly with accessorsMatthew Olsson
2020-05-30LibJS: Parse arrow function expression with correct precedenceMarcin Gasperowicz
The parser was chomping on commas present after the arrow function expression. eg. [x=>x,2] would parse as [x=>(x,2)] instead of [(x=>x),2]. This is not the case anymore. I've added a small test to prove this.