summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-03-19 22:24:21 +0330
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-03-20 10:44:32 +0330
commita5958b5f45bcaab7e63b9ffdba681dcb9474237d (patch)
tree5a802ee619f96589ed5d5ced22794488733290d9 /Userland/Libraries/LibJS
parent1d95745901aced2f272cdf3c2a05d0deea3d91a3 (diff)
downloadserenity-a5958b5f45bcaab7e63b9ffdba681dcb9474237d.zip
LibJS: Allow 'expect().fail("some random string")' in test-js
Previously fail() wanted the fail object to be a callable, allow it to be a string also.
Diffstat (limited to 'Userland/Libraries/LibJS')
-rw-r--r--Userland/Libraries/LibJS/Tests/test-common.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Tests/test-common.js b/Userland/Libraries/LibJS/Tests/test-common.js
index bbdc80fc9b..3f5e51d24b 100644
--- a/Userland/Libraries/LibJS/Tests/test-common.js
+++ b/Userland/Libraries/LibJS/Tests/test-common.js
@@ -512,7 +512,8 @@ class ExpectationError extends Error {
__expect(value, details) {
if (value !== true) {
if (details !== undefined) {
- throw new ExpectationError(details());
+ if (details instanceof Function) throw new ExpectationError(details());
+ else throw new ExpectationError(details);
} else {
throw new ExpectationError();
}