Commit c28b38b9 authored by Dominik Charousset's avatar Dominik Charousset

Implement unit test for regression in spawn

parent 1b1aae99
...@@ -568,6 +568,10 @@ CAF_TEST(move_only_argument) { ...@@ -568,6 +568,10 @@ CAF_TEST(move_only_argument) {
CAF_CHECK_EQUAL(to_string(f(1.f)), "(42)"); CAF_CHECK_EQUAL(to_string(f(1.f)), "(42)");
} }
CAF_TEST_FIXTURE_SCOPE_END()
CAF_TEST_FIXTURE_SCOPE(dynamic_spawn_tests_2, test_coordinator_fixture<>)
CAF_TEST(move-only function object) { CAF_TEST(move-only function object) {
struct move_only_fun { struct move_only_fun {
move_only_fun() = default; move_only_fun() = default;
...@@ -578,10 +582,20 @@ CAF_TEST(move-only function object) { ...@@ -578,10 +582,20 @@ CAF_TEST(move-only function object) {
return {}; return {};
} }
}; };
actor_system_config cfg;
actor_system sys{cfg};
move_only_fun f; move_only_fun f;
sys.spawn(std::move(f)); sys.spawn(std::move(f));
run();
}
#define SUBTEST(message) \
CAF_MESSAGE(message); \
for (int subtest_dummy = 0; subtest_dummy < 1; ++subtest_dummy, run())
CAF_TEST(sys.spawn implicitly converts arguments) {
SUBTEST("spawn accepts functions taking pointers") {
auto f = [](int* ptr) { CAF_CHECK_EQUAL(ptr, nullptr); };
sys.spawn(f, nullptr);
}
} }
CAF_TEST_FIXTURE_SCOPE_END() CAF_TEST_FIXTURE_SCOPE_END()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment