Adds a standard-format exception message to OpmInputError.

This commit is contained in:
Williham Williham Totland
2020-10-02 14:35:04 +02:00
parent 65f45b60a8
commit 3af6fac35d
4 changed files with 58 additions and 16 deletions

View File

@@ -94,3 +94,26 @@ Internal error: Runtime Error)" };
BOOST_CHECK_EQUAL(opm_error.what(), expected);
}
}
const Opm::KeywordLocation location2 { "MZUNSUPP", "FILENAME.DAT", 45 } ;
BOOST_AUTO_TEST_CASE(exception_multi_1) {
const std::string expected { R"(Problem parsing keyword MXUNSUPP
In FILENAME.DAT line 42
Parse error: Runtime Error)" } ;
const std::string formatted { Opm::OpmInputError({ location }, "Runtime Error").what() } ;
BOOST_CHECK_EQUAL(formatted, expected);
}
BOOST_AUTO_TEST_CASE(exception_multi_2) {
const std::string expected { R"(Problem parsing keywords
MXUNSUPP in FILENAME.DAT, line 42
MZUNSUPP in FILENAME.DAT, line 45
Parse error: Runtime Error)" } ;
const std::string formatted { Opm::OpmInputError({ location, location2 }, "Runtime Error").what() } ;
BOOST_CHECK_EQUAL(formatted, expected);
}