Browse Source

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

Michele Caini 5 years ago
parent
commit
14915368c7
2 changed files with 4 additions and 4 deletions
  1. 3 3
      test/entt/core/any.cpp
  2. 1 1
      test/entt/meta/meta_pointer.cpp

+ 3 - 3
test/entt/core/any.cpp

@@ -697,7 +697,7 @@ TEST(Any, AsRef) {
     ASSERT_EQ(entt::any_cast<const int &>(any), 42);
     ASSERT_EQ(entt::any_cast<const int &>(any), 42);
     ASSERT_EQ(entt::any_cast<int &>(ref), 42);
     ASSERT_EQ(entt::any_cast<int &>(ref), 42);
     ASSERT_EQ(entt::any_cast<const 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);
     ASSERT_EQ(entt::any_cast<const int &>(cref), 42);
 
 
     entt::any_cast<int &>(any) = 3;
     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>(&ref), any.data());
     ASSERT_EQ(entt::any_cast<const int>(&cref), 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 &>(ref), 3);
     ASSERT_EQ(entt::any_cast<const int &>(cref), 3);
     ASSERT_EQ(entt::any_cast<const int &>(cref), 3);

+ 1 - 1
test/entt/meta/meta_pointer.cpp

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