Merge pull request #3027 from bska/attribute-missing-kw-terminator
Attribute Missing Terminator to Keyword/File/Line
This commit is contained in:
commit
180b7cb664
@ -927,8 +927,12 @@ std::unique_ptr<RawKeyword> tryParseKeyword( ParserState& parserState, const Par
|
|||||||
if (rawKeyword->can_complete())
|
if (rawKeyword->can_complete())
|
||||||
rawKeyword->terminateKeyword();
|
rawKeyword->terminateKeyword();
|
||||||
|
|
||||||
if (!rawKeyword->isFinished())
|
if (!rawKeyword->isFinished()) {
|
||||||
throw std::invalid_argument("Keyword " + rawKeyword->getKeywordName() + " is not properly terminated");
|
throw OpmInputError {
|
||||||
|
"Keyword is not properly terminated.",
|
||||||
|
rawKeyword->location()
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rawKeyword;
|
return rawKeyword;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <boost/test/tools/floating_point_comparison.hpp>
|
#include <boost/test/tools/floating_point_comparison.hpp>
|
||||||
|
|
||||||
#include <opm/common/utility/OpmInputError.hpp>
|
#include <opm/common/utility/OpmInputError.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/Parser/Parser.hpp>
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
||||||
@ -1987,11 +1988,7 @@ OPERATE
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_CHECK_THROW(make_fp(invalid_copy), OpmInputError);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOST_CHECK_THROW(make_fp(invalid_copy), std::logic_error);
|
|
||||||
BOOST_CHECK_THROW(make_fp(invalid_region), std::logic_error);
|
BOOST_CHECK_THROW(make_fp(invalid_region), std::logic_error);
|
||||||
BOOST_CHECK_THROW(make_fp(invalid_operate), std::logic_error);
|
BOOST_CHECK_THROW(make_fp(invalid_operate), std::logic_error);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
#include <boost/test/test_tools.hpp>
|
#include <boost/test/test_tools.hpp>
|
||||||
|
|
||||||
|
#include <opm/common/utility/OpmInputError.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/Deck/Deck.hpp>
|
#include <opm/input/eclipse/Deck/Deck.hpp>
|
||||||
#include <opm/input/eclipse/Deck/DeckItem.hpp>
|
#include <opm/input/eclipse/Deck/DeckItem.hpp>
|
||||||
#include <opm/input/eclipse/Deck/DeckKeyword.hpp>
|
#include <opm/input/eclipse/Deck/DeckKeyword.hpp>
|
||||||
@ -37,33 +39,33 @@ using namespace Opm;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char *dataMissingRecord = "\n\
|
const char *dataMissingRecord = R"(
|
||||||
ENDSCALE\n\
|
ENDSCALE
|
||||||
1* 1* 2 /\n\
|
1* 1* 2 /
|
||||||
\n\
|
|
||||||
ENKRVD\n\
|
ENKRVD
|
||||||
100 1 2 3 4 5 6 7 200 11 22 33 44 55 66 77 /\n\
|
100 1 2 3 4 5 6 7 200 11 22 33 44 55 66 77 /
|
||||||
";
|
)";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE( ParseMissingRECORD_THrows) {
|
BOOST_AUTO_TEST_CASE( ParseMissingRECORD_THrows) {
|
||||||
Parser parser;
|
Parser parser;
|
||||||
BOOST_CHECK_THROW( parser.parseString( dataMissingRecord ), std::invalid_argument );
|
BOOST_CHECK_THROW( parser.parseString( dataMissingRecord ), OpmInputError );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const char *data = "\n\
|
const char *data = R"(
|
||||||
ENDSCALE\n\
|
ENDSCALE
|
||||||
1* 1* 3 /\n\
|
1* 1* 3 /
|
||||||
\n\
|
|
||||||
ENKRVD\n\
|
ENKRVD
|
||||||
100 * 2 * 2* 6 7 200 11 22 33 3*55 10 /\n\
|
100 * 2 * 2* 6 7 200 11 22 33 3*55 10 /
|
||||||
100 * 2 3 4 5 6 7 200 11 22 33 44 55 66 77 /\n\
|
100 * 2 3 4 5 6 7 200 11 22 33 44 55 66 77 /
|
||||||
100 * 2 3 4 5 6 7 200 11 22 33 44 55 66 * /\n\
|
100 * 2 3 4 5 6 7 200 11 22 33 44 55 66 * /
|
||||||
";
|
)";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,17 +23,20 @@
|
|||||||
|
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/Parser/Parser.hpp>
|
#include <opm/common/utility/OpmInputError.hpp>
|
||||||
#include <opm/input/eclipse/Deck/DeckSection.hpp>
|
|
||||||
#include <opm/input/eclipse/Parser/ParserKeywords/C.hpp>
|
|
||||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
|
#include <opm/input/eclipse/EclipseState/Runspec.hpp>
|
||||||
|
#include <opm/input/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
|
||||||
|
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
#include <opm/input/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/SimulationConfig/RockConfig.hpp>
|
#include <opm/input/eclipse/EclipseState/SimulationConfig/RockConfig.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
|
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
|
|
||||||
#include <opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp>
|
|
||||||
|
|
||||||
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
||||||
|
#include <opm/input/eclipse/Parser/ParserKeywords/C.hpp>
|
||||||
|
|
||||||
|
#include <opm/input/eclipse/Deck/DeckSection.hpp>
|
||||||
|
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
|
|
||||||
@ -211,7 +214,7 @@ BOOST_AUTO_TEST_CASE(SimulationConfigCPRBoth) {
|
|||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(SimulationConfigCPRRUnspecWithData) {
|
BOOST_AUTO_TEST_CASE(SimulationConfigCPRRUnspecWithData) {
|
||||||
BOOST_CHECK_THROW( createDeck(inputStr_INVALID) , std::invalid_argument );
|
BOOST_CHECK_THROW( createDeck(inputStr_INVALID) , Opm::OpmInputError );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,12 +24,17 @@
|
|||||||
#define BOOST_TEST_MODULE ReportConfigTest
|
#define BOOST_TEST_MODULE ReportConfigTest
|
||||||
#include <boost/test/unit_test.hpp>
|
#include <boost/test/unit_test.hpp>
|
||||||
|
|
||||||
|
#include <opm/common/utility/OpmInputError.hpp>
|
||||||
|
|
||||||
|
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/Schedule/RPTConfig.hpp>
|
#include <opm/input/eclipse/Schedule/RPTConfig.hpp>
|
||||||
#include <opm/input/eclipse/Schedule/Schedule.hpp>
|
#include <opm/input/eclipse/Schedule/Schedule.hpp>
|
||||||
|
|
||||||
|
#include <opm/input/eclipse/Python/Python.hpp>
|
||||||
|
|
||||||
#include <opm/input/eclipse/Deck/Deck.hpp>
|
#include <opm/input/eclipse/Deck/Deck.hpp>
|
||||||
#include <opm/input/eclipse/Parser/Parser.hpp>
|
#include <opm/input/eclipse/Parser/Parser.hpp>
|
||||||
#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
|
|
||||||
#include <opm/input/eclipse/Python/Python.hpp>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -96,9 +101,9 @@ RPTSCHED
|
|||||||
FIPSOL=2.50
|
FIPSOL=2.50
|
||||||
)";
|
)";
|
||||||
|
|
||||||
BOOST_CHECK_THROW(make_schedule(sched_string1), std::invalid_argument);
|
BOOST_CHECK_THROW(make_schedule(sched_string1), Opm::OpmInputError);
|
||||||
BOOST_CHECK_THROW(make_schedule(sched_string2), std::invalid_argument);
|
BOOST_CHECK_THROW(make_schedule(sched_string2), Opm::OpmInputError);
|
||||||
BOOST_CHECK_THROW(make_schedule(sched_string3), std::invalid_argument);
|
BOOST_CHECK_THROW(make_schedule(sched_string3), Opm::OpmInputError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user