Prevent std::exit(1) in tests due to ErrorGuard's destructor.

If ErrorGuard's lists have not been cleared, then it's destructor
will call std::exit(1). As that is quite unfortunate in a test, we
clear it's message stack at the end of the tests.
This commit is contained in:
Markus Blatt
2023-07-20 10:25:37 +02:00
parent e56e2f4d26
commit 016dfa9ea7
2 changed files with 9 additions and 0 deletions

View File

@@ -253,6 +253,9 @@ BOOST_AUTO_TEST_CASE(Section_ValidDecks) {
"TEST8\n";
BOOST_CHECK(Opm::DeckSection::checkSectionTopology( parser.parseString( with_opt, mode, errors ), parser, errors));
// prevent std::exit(1) in ErrorGuard's destructor!
errors.dump();
errors.clear();
}
BOOST_AUTO_TEST_CASE(Section_InvalidDecks) {
@@ -390,4 +393,7 @@ BOOST_AUTO_TEST_CASE(Section_InvalidDecks) {
"TEST4\n";
BOOST_CHECK(!Opm::DeckSection::checkSectionTopology( parser.parseString( missing_SCHEDULE, mode, errors ), parser, errors));
// prevent std::exit(1) in ErrorGuard's destructor!
errors.dump();
errors.clear();
}

View File

@@ -102,4 +102,7 @@ BOOST_AUTO_TEST_CASE( KeywordInCorrectSection ) {
// this fails because of the incorrect BOX keyword
BOOST_CHECK(!Opm::checkDeck(deck, parser, parseContext, errorGuard, Opm::SectionTopology | Opm::KeywordSection));
}
// prevent std::exit(1) in ErrorGuard's destructor!
errorGuard.dump();
errorGuard.clear();
}