1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 22:27:44 +00:00

LibJS/Tests: Use eval() for toEvalTo(), not Function()

Since we have had eval() for a while now, we can finally use it here -
this allows us to get rid of the confusing return statements in tested
source code.
This commit is contained in:
Linus Groh 2021-06-18 19:09:17 +01:00
parent 2e9f665bda
commit 299c3069c1
5 changed files with 8 additions and 10 deletions

View file

@ -333,13 +333,11 @@ test("toEval", () => {
expect("function foo() { return 1; }; foo();").toEval();
});
// FIXME: Will have to change when this matcher changes to use the
// "eval" function
test("toEvalTo", () => {
expect("let a = 1").toEvalTo();
expect("let a = 1").toEvalTo(undefined);
expect("return 10").toEvalTo(10);
expect("return 10").not.toEvalTo(5);
expect("10").toEvalTo(10);
expect("10").not.toEvalTo(5);
expect(() => {
expect("*^&%%").not.toEvalTo();