Home > other >  GoogleTest: How to catch a generic exception in EXPECT_THROW?
GoogleTest: How to catch a generic exception in EXPECT_THROW?

Time:04-07

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 (...) {
 
}

CodePudding user response:

EXPECT_ANY_THROW is for this purpose.

See Advanced googletest topics.

  • Related