summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibJS/Tests/automatic-semicolon-insertion.js4
-rw-r--r--Userland/Libraries/LibJS/Tests/comments-basic.js4
-rw-r--r--Userland/Libraries/LibJS/Tests/operators/ternary-basic.js2
-rw-r--r--Userland/Libraries/LibJS/Tests/test-common-tests.js6
-rw-r--r--Userland/Libraries/LibJS/Tests/test-common.js2
5 files changed, 8 insertions, 10 deletions
diff --git a/Userland/Libraries/LibJS/Tests/automatic-semicolon-insertion.js b/Userland/Libraries/LibJS/Tests/automatic-semicolon-insertion.js
index 998b0b6622..32db0b81f3 100644
--- a/Userland/Libraries/LibJS/Tests/automatic-semicolon-insertion.js
+++ b/Userland/Libraries/LibJS/Tests/automatic-semicolon-insertion.js
@@ -37,7 +37,7 @@ test("break/continue, variable declaration, do-while, and return asi", () => {
1;
var curly/* semicolon inserted here */}
-return foo();`;
+foo();`;
expect(source).toEvalTo(undefined);
});
@@ -55,7 +55,7 @@ for (let i = 0; i < 5; ++i) {
counter++;
}
-return counter;`;
+counter;`;
expect(source).toEvalTo(5);
});
diff --git a/Userland/Libraries/LibJS/Tests/comments-basic.js b/Userland/Libraries/LibJS/Tests/comments-basic.js
index 3dbe6aec1e..101e520a29 100644
--- a/Userland/Libraries/LibJS/Tests/comments-basic.js
+++ b/Userland/Libraries/LibJS/Tests/comments-basic.js
@@ -7,7 +7,7 @@ var i = 0;
i++;
*/
/**/ i++;
-return i;`;
+i;`;
expect(source).toEvalTo(1);
});
@@ -22,7 +22,7 @@ i++;
--> i++;
/**/ --> i++;
j --> i++;
-return i;`;
+i;`;
expect(source).toEvalTo(2);
});
diff --git a/Userland/Libraries/LibJS/Tests/operators/ternary-basic.js b/Userland/Libraries/LibJS/Tests/operators/ternary-basic.js
index c0f68fdf83..81e808cdef 100644
--- a/Userland/Libraries/LibJS/Tests/operators/ternary-basic.js
+++ b/Userland/Libraries/LibJS/Tests/operators/ternary-basic.js
@@ -16,5 +16,5 @@ test("object values", () => {
});
test("issue #4409, '?.' followed by decimal digit", () => {
- expect("return false?.1:.2").toEvalTo(0.2);
+ expect("false?.1:.2").toEvalTo(0.2);
});
diff --git a/Userland/Libraries/LibJS/Tests/test-common-tests.js b/Userland/Libraries/LibJS/Tests/test-common-tests.js
index a857d327bb..1801bb078d 100644
--- a/Userland/Libraries/LibJS/Tests/test-common-tests.js
+++ b/Userland/Libraries/LibJS/Tests/test-common-tests.js
@@ -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();
diff --git a/Userland/Libraries/LibJS/Tests/test-common.js b/Userland/Libraries/LibJS/Tests/test-common.js
index 911d194dd9..3c0eec4f11 100644
--- a/Userland/Libraries/LibJS/Tests/test-common.js
+++ b/Userland/Libraries/LibJS/Tests/test-common.js
@@ -354,7 +354,7 @@ class ExpectationError extends Error {
let result;
try {
- result = new Function(this.target)();
+ result = eval(this.target);
} catch (e) {
throw new ExpectationError();
}