sigh: more tests

This commit is contained in:
Michele Caini
2019-07-05 13:35:44 +02:00
parent 23aa097d0a
commit 52e7b50e9b

View File

@@ -243,14 +243,27 @@ TEST(SigH, ScopedConnectionConstructorsAndOperators) {
ASSERT_FALSE(listener.k);
ASSERT_FALSE(conn);
auto basic = sink.connect<&sigh_listener::g>(&listener);
entt::scoped_connection inner = std::move(basic);
entt::scoped_connection inner{};
inner = sink.connect<&sigh_listener::g>(&listener);
sigh.publish(42);
ASSERT_FALSE(sigh.empty());
ASSERT_TRUE(listener.k);
ASSERT_TRUE(inner);
inner.release();
ASSERT_TRUE(sigh.empty());
ASSERT_FALSE(inner);
auto basic = sink.connect<&sigh_listener::g>(&listener);
inner = std::as_const(basic);
sigh.publish(42);
ASSERT_FALSE(sigh.empty());
ASSERT_FALSE(listener.k);
ASSERT_TRUE(inner);
conn = std::move(inner);
ASSERT_FALSE(inner);
@@ -263,7 +276,7 @@ TEST(SigH, ScopedConnectionConstructorsAndOperators) {
sigh.publish(42);
ASSERT_TRUE(sigh.empty());
ASSERT_TRUE(listener.k);
ASSERT_FALSE(listener.k);
}
TEST(SigH, ConstNonConstNoExcept) {