test: avoid some ASSERT_DEATH that don't trigger in release mode

This commit is contained in:
Michele Caini
2021-02-04 11:50:52 +01:00
parent 0ff5c18743
commit 14915368c7
2 changed files with 4 additions and 4 deletions

View File

@@ -697,7 +697,7 @@ TEST(Any, AsRef) {
ASSERT_EQ(entt::any_cast<const int &>(any), 42);
ASSERT_EQ(entt::any_cast<int &>(ref), 42);
ASSERT_EQ(entt::any_cast<const int &>(ref), 42);
ASSERT_DEATH(entt::any_cast<int &>(cref), ".*");
ASSERT_EQ(entt::any_cast<int>(&cref), nullptr);
ASSERT_EQ(entt::any_cast<const int &>(cref), 42);
entt::any_cast<int &>(any) = 3;
@@ -719,8 +719,8 @@ TEST(Any, AsRef) {
ASSERT_EQ(entt::any_cast<const int>(&ref), any.data());
ASSERT_EQ(entt::any_cast<const int>(&cref), any.data());
ASSERT_DEATH(entt::any_cast<int &>(ref), ".*");
ASSERT_DEATH(entt::any_cast<int &>(cref), ".*");
ASSERT_EQ(entt::any_cast<int>(&ref), nullptr);
ASSERT_EQ(entt::any_cast<int>(&cref), nullptr);
ASSERT_EQ(entt::any_cast<const int &>(ref), 3);
ASSERT_EQ(entt::any_cast<const int &>(cref), 3);

View File

@@ -164,9 +164,9 @@ TEST(MetaPointerLike, PointerToConstMoveOnlyType) {
ASSERT_TRUE(any);
ASSERT_TRUE(deref);
ASSERT_DEATH(deref.cast<not_copyable_t &>() = {}, ".*");
ASSERT_EQ(deref.try_cast<not_copyable_t>(), nullptr);
ASSERT_NE(deref.try_cast<const not_copyable_t>(), nullptr);
ASSERT_EQ(&deref.cast<const not_copyable_t &>(), &instance);
}
TEST(MetaPointerLike, AsRef) {