Skip to content

Commit

Permalink
packio: fix tests expectation
Browse files Browse the repository at this point in the history
  • Loading branch information
qchateau committed Dec 25, 2022
1 parent 34d6ea0 commit 092be98
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ set(SOURCES
tests/basic_test_timeout.cpp
tests/basic_test_functions.cpp
tests/basic_test_named_arguments.cpp
tests/basic_test_default_arguments.cpp
tests/basic_test_dispatcher.cpp
tests/basic_test_end_of_work.cpp
tests/basic_test_special_callables.cpp
Expand Down
23 changes: 14 additions & 9 deletions test_package/tests/basic_test_default_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TYPED_TEST(BasicTest, test_default_arguments)
typename std::decay_t<decltype(*this)>::completion_handler;
using rpc_type = typename std::decay_t<decltype(*this)>::client_type::rpc_type;
constexpr bool has_named_args =
std::is_same_v<rpc_type, packio::nl_json_rpc::rpc>;
!std::is_same_v<rpc_type, packio::msgpack_rpc::rpc>;

this->server_->async_serve_forever();
this->async_run();
Expand Down Expand Up @@ -131,11 +131,11 @@ TYPED_TEST(BasicTest, test_default_arguments)
// -- add_first_default --
EXPECT_ERROR_MESSAGE(
this->client_,
"Incompatible arguments",
"cannot convert arguments: no value for argument b",
prefix + "add_first_default");
EXPECT_ERROR_MESSAGE(
this->client_,
"Incompatible arguments",
"cannot convert arguments: no value for argument b",
prefix + "add_first_default",
1);
EXPECT_RESULT_EQ(
Expand All @@ -153,7 +153,7 @@ TYPED_TEST(BasicTest, test_default_arguments)
// -- add_second_default --
EXPECT_ERROR_MESSAGE(
this->client_,
"Incompatible arguments",
"cannot convert arguments: no value for argument a",
prefix + "add_second_default");
EXPECT_RESULT_EQ(
this->client_->async_call(
Expand Down Expand Up @@ -193,7 +193,12 @@ TYPED_TEST(BasicTest, test_default_arguments)
25);
EXPECT_ERROR_MESSAGE(
this->client_,
"cannot convert arguments: too many arguments",
"cannot convert arguments: unexpected argument c",
prefix + "add_all_default",
arg("c") = 3);
EXPECT_ERROR_MESSAGE(
this->client_,
"cannot convert arguments: unexpected argument c",
prefix + "add_all_default",
arg("a") = 1,
arg("b") = 2,
Expand All @@ -202,7 +207,7 @@ TYPED_TEST(BasicTest, test_default_arguments)
// -- add_first_default --
EXPECT_ERROR_MESSAGE(
this->client_,
"Incompatible arguments",
"cannot convert arguments: no value for argument b",
prefix + "add_first_default",
arg("a") = 12);
EXPECT_RESULT_EQ(
Expand All @@ -219,7 +224,7 @@ TYPED_TEST(BasicTest, test_default_arguments)
25);
EXPECT_ERROR_MESSAGE(
this->client_,
"cannot convert arguments: too many arguments",
"cannot convert arguments: unexpected argument c",
prefix + "add_first_default",
arg("a") = 1,
arg("b") = 2,
Expand All @@ -234,7 +239,7 @@ TYPED_TEST(BasicTest, test_default_arguments)
112);
EXPECT_ERROR_MESSAGE(
this->client_,
"Incompatible arguments",
"cannot convert arguments: no value for argument a",
prefix + "add_second_default",
arg("b") = 13);
EXPECT_RESULT_EQ(
Expand All @@ -245,7 +250,7 @@ TYPED_TEST(BasicTest, test_default_arguments)
25);
EXPECT_ERROR_MESSAGE(
this->client_,
"cannot convert arguments: too many arguments",
"cannot convert arguments: unexpected argument c",
prefix + "add_second_default",
arg("a") = 1,
arg("b") = 2,
Expand Down

0 comments on commit 092be98

Please sign in to comment.