diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2021-08-30 13:31:09 +0000 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-09-02 03:47:47 +0430 |
commit | b5a145b46677dd0853ffa65842a2a6cfe06ca061 (patch) | |
tree | 18d3ed4af8f5afc29f8ef8357c9b181b2e85ab8a /Tests/LibCore/TestLibCoreDeferredInvoke.cpp | |
parent | 749f62860e4b8406c4059107bd2c2ba63119d3ce (diff) | |
download | serenity-b5a145b46677dd0853ffa65842a2a6cfe06ca061.zip |
Tests: Add tests for Core::deferred_invoke
Diffstat (limited to 'Tests/LibCore/TestLibCoreDeferredInvoke.cpp')
-rw-r--r-- | Tests/LibCore/TestLibCoreDeferredInvoke.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Tests/LibCore/TestLibCoreDeferredInvoke.cpp b/Tests/LibCore/TestLibCoreDeferredInvoke.cpp new file mode 100644 index 0000000000..097d22ab5e --- /dev/null +++ b/Tests/LibCore/TestLibCoreDeferredInvoke.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2021, sin-ack <sin-ack@protonmail.com> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <AK/Format.h> +#include <LibCore/EventLoop.h> +#include <LibCore/Timer.h> +#include <LibTest/TestCase.h> + +TEST_CASE(deferred_invoke) +{ + Core::EventLoop event_loop; + auto reaper = Core::Timer::create_single_shot(250, [] { + warnln("I waited for the deferred_invoke to happen, but it never did!"); + VERIFY_NOT_REACHED(); + }); + + Core::deferred_invoke([&event_loop] { + event_loop.quit(0); + }); + + event_loop.exec(); +} |