mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-29 12:49:08 +00:00
LibJS: Rewrite Parser.parse_object_expression()
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.
This commit is contained in:
committed by
Andreas Kling
parent
05b7fec517
commit
ab576e610c
@@ -50,6 +50,18 @@ function assertThrowsError(testFunction, options) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the provided JavaScript source code results in a SyntaxError
|
||||
* @param {string} source The JavaScript source code to compile
|
||||
*/
|
||||
function assertIsSyntaxError(source) {
|
||||
assertThrowsError(() => {
|
||||
new Function(source)();
|
||||
}, {
|
||||
error: SyntaxError,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures the provided arrays contain exactly the same items.
|
||||
* @param {Array} a First array
|
||||
|
||||
Reference in New Issue
Block a user