소스 검색

test: context aware meta handle

Michele Caini 3 년 전
부모
커밋
92a00f591d
1개의 변경된 파일19개의 추가작업 그리고 1개의 파일을 삭제
  1. 19 1
      test/entt/meta/meta_context.cpp

+ 19 - 1
test/entt/meta/meta_context.cpp

@@ -418,7 +418,25 @@ TEST_F(MetaContext, MetaAny) {
 }
 
 TEST_F(MetaContext, MetaHandle) {
-    // TODO
+    using namespace entt::literals;
+
+    int value = 42;
+
+    entt::meta_handle global{value};
+    entt::meta_handle ctx_value{context, value};
+    entt::meta_handle two_step_local{entt::meta_ctx_arg, context};
+
+    ASSERT_TRUE(global);
+    ASSERT_TRUE(ctx_value);
+    ASSERT_FALSE(two_step_local);
+
+    two_step_local->emplace<int &>(value);
+
+    ASSERT_TRUE(two_step_local);
+
+    ASSERT_EQ(global->type().data("marker"_hs).get({}).cast<int>(), global_marker);
+    ASSERT_EQ(ctx_value->type().data("marker"_hs).get({}).cast<int>(), local_marker);
+    ASSERT_EQ(two_step_local->type().data("marker"_hs).get({}).cast<int>(), local_marker);
 }
 
 TEST_F(MetaContext, ForwardAsMeta) {