Trigger cases by the JSON (and not string) interface

This commit is contained in:
Alex Beregszaszi 2017-04-19 17:41:55 +01:00
parent 10ec334f74
commit 137ef78e9a

View File

@ -87,7 +87,17 @@ BOOST_AUTO_TEST_SUITE(StandardCompiler)
BOOST_AUTO_TEST_CASE(assume_object_input)
{
Json::Value result = compile("");
Json::Value result;
/// Use the native JSON interface of StandardCompiler to trigger these
solidity::StandardCompiler compiler;
result = compiler.compile(Json::Value());
BOOST_CHECK(containsError(result, "JSONError", "Input is not a JSON object."));
result = compiler.compile(Json::Value("INVALID"));
BOOST_CHECK(containsError(result, "JSONError", "Input is not a JSON object."));
/// Use the string interface of StandardCompiler to trigger these
result = compile("");
BOOST_CHECK(containsError(result, "JSONError", "* Line 1, Column 1\n Syntax error: value, object or array expected.\n"));
result = compile("invalid");
BOOST_CHECK(containsError(result, "JSONError", "* Line 1, Column 1\n Syntax error: value, object or array expected.\n"));