summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorBrian Gianforcaro <b.gianfo@gmail.com>2020-04-13 10:31:13 -0700
committerAndreas Kling <kling@serenityos.org>2020-04-14 12:55:31 +0200
commitd74ad81402c27113b2ed5586bc369703d6be61c4 (patch)
tree43aaf62b9467d55f7ad3002d049c7f050930475a /Userland
parent9477efe97032f15438b51bf01e2958cc76c554be (diff)
downloadserenity-d74ad81402c27113b2ed5586bc369703d6be61c4.zip
js/LibJS: Move test functions to pure javascript.
The addition of assert functions to Userland/js was done before we had load(..) implemented. Now that it exists, it seems like the right move the test helper functions to pure javascript instead of poluting js with random global functions.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/js.cpp19
1 files changed, 0 insertions, 19 deletions
diff --git a/Userland/js.cpp b/Userland/js.cpp
index a31b932792..bb09165b17 100644
--- a/Userland/js.cpp
+++ b/Userland/js.cpp
@@ -372,28 +372,9 @@ void repl(JS::Interpreter& interpreter)
}
}
-JS::Value assert_impl(JS::Interpreter& interpreter)
-{
- if (!interpreter.argument_count())
- return interpreter.throw_exception<JS::TypeError>("No arguments specified");
-
- auto assertion_value = interpreter.argument(0).to_boolean();
- if (!assertion_value)
- return interpreter.throw_exception<JS::Error>("AssertionError", "The assertion failed!");
-
- return JS::Value(assertion_value);
-}
-
-JS::Value assert_not_reached(JS::Interpreter& interpreter)
-{
- return interpreter.throw_exception<JS::Error>("AssertionError", "assertNotReached() was reached!");
-}
-
void enable_test_mode(JS::Interpreter& interpreter)
{
interpreter.global_object().put_native_function("load", ReplObject::load_file);
- interpreter.global_object().put_native_function("assert", assert_impl);
- interpreter.global_object().put_native_function("assertNotReached", assert_not_reached);
}
int main(int argc, char** argv)