From 45419dab46d1d56d64a29a2b9b3d4d37494cb350 Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Sun, 21 Jan 2024 16:11:35 +0800 Subject: [PATCH] feat update --- tests/3party/rpc_core/rpc_core_unittest.cpp | 26 +++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/3party/rpc_core/rpc_core_unittest.cpp b/tests/3party/rpc_core/rpc_core_unittest.cpp index aeb84c9..2144179 100644 --- a/tests/3party/rpc_core/rpc_core_unittest.cpp +++ b/tests/3party/rpc_core/rpc_core_unittest.cpp @@ -24,17 +24,29 @@ TEST(rpc_core, base) }); rpc_s->set_ready(true); - rpc_s->subscribe( - "test", [](const std::string &msg) -> std::string { return "ok"; }); - auto rpc_c = rpc_core::rpc::create(loopback); rpc_c->set_timer([](uint32_t ms, const rpc_core::rpc::timeout_cb &cb) { RPC_CORE_UNUSED(ms); RPC_CORE_UNUSED(cb); }); rpc_c->set_ready(true); - rpc_c->cmd("test") - ->msg(std::string("hello")) - ->rsp([](const std::string &rsp) { EXPECT_EQ(rsp, "ok"); }) - ->call(); + + { + rpc_s->subscribe( + "test", [](const std::string &msg) -> std::string { return "ok"; }); + rpc_c->cmd("test") + ->msg(std::string("hello")) + ->rsp([](const std::string &rsp) { EXPECT_EQ(rsp, "ok"); }) + ->call(); + } + + { + TestType test_type; + rpc_s->subscribe("call1", + [](const TestType &val) -> TestType { return val; }); + rpc_c->cmd("call1") + ->msg(test_type) + ->rsp([](const TestType &val) {}) + ->call(); + } }