Browse Source

test: a few more tests for meta_handle

Michele Caini 3 years ago
parent
commit
b6155080b2
1 changed files with 10 additions and 1 deletions
  1. 10 1
      test/entt/meta/meta_handle.cpp

+ 10 - 1
test/entt/meta/meta_handle.cpp

@@ -39,19 +39,28 @@ TEST_F(MetaHandle, Functionalities) {
 
     clazz_t instance{};
     entt::meta_handle handle{};
+    entt::meta_handle chandle{};
 
     ASSERT_FALSE(handle);
+    ASSERT_FALSE(chandle);
 
     handle = entt::meta_handle{instance};
+    chandle = entt::meta_handle{std::as_const(instance)};
 
     ASSERT_TRUE(handle);
+    ASSERT_TRUE(chandle);
+
     ASSERT_TRUE(handle->invoke("incr"_hs));
+    ASSERT_FALSE(chandle->invoke("incr"_hs));
+    ASSERT_FALSE(std::as_const(handle)->invoke("incr"_hs));
     ASSERT_EQ(instance.value, 1);
 
     auto any = entt::forward_as_meta(instance);
     handle = entt::meta_handle{any};
+    chandle = entt::meta_handle{std::as_const(any)};
 
-    ASSERT_FALSE(std::as_const(handle)->invoke("decr"_hs));
     ASSERT_TRUE(handle->invoke("decr"_hs));
+    ASSERT_FALSE(chandle->invoke("decr"_hs));
+    ASSERT_FALSE(std::as_const(handle)->invoke("decr"_hs));
     ASSERT_EQ(instance.value, 0);
 }