Skip to content

Commit

Permalink
fix: add try catch for function_check_test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dup4 committed Jan 13, 2023
1 parent 1cfe748 commit a5300a7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/autowired_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,13 @@ TEST_F(AutoWiredTest, need_init_test) {
TEST_F(AutoWiredTest, function_check_test) {
auto_wired::AutoWired a;

EXPECT_THROW(a.Register<G>(auto_wired::AutoWired::RegisterOptions::WithNeedAutoWired()), std::runtime_error);
EXPECT_THROW(a.Register<G>(auto_wired::AutoWired::RegisterOptions::WithNeedInit()), std::runtime_error);
EXPECT_THROW(a.Register<G>(auto_wired::AutoWired::RegisterOptions::WithNeedDeInit()), std::runtime_error);
try {
EXPECT_THROW(a.Register<G>(auto_wired::AutoWired::RegisterOptions::WithNeedAutoWired()), std::runtime_error);
EXPECT_THROW(a.Register<G>(auto_wired::AutoWired::RegisterOptions::WithNeedInit()), std::runtime_error);
EXPECT_THROW(a.Register<G>(auto_wired::AutoWired::RegisterOptions::WithNeedDeInit()), std::runtime_error);
} catch (...) {
EXPECT_TRUE(false);
}
}

TEST_F(AutoWiredTest, register_index_test) {
Expand Down

0 comments on commit a5300a7

Please sign in to comment.