Amit
Amit

Reputation: 63

GoogleTest: How to catch a generic exception in EXPECT_THROW?

Hi i want to catch a generic exception in function EXPECT_THROW GoogleTest ,which can catch all the type of exception thrown, irrespective of exception type.

Is their any similar way as we used to catch in try-catch block.

catch (...) {
 
}

Upvotes: 1

Views: 2870

Answers (1)

3CxEZiVlQ
3CxEZiVlQ

Reputation: 38341

EXPECT_ANY_THROW is for this purpose.

See Advanced googletest topics.

Upvotes: 2

Related Questions