diff options
Diffstat (limited to 'test/libsolidity/StandardCompiler.cpp')
-rw-r--r-- | test/libsolidity/StandardCompiler.cpp | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp index 3aa1dc24..1570a9d2 100644 --- a/test/libsolidity/StandardCompiler.cpp +++ b/test/libsolidity/StandardCompiler.cpp @@ -225,6 +225,71 @@ BOOST_AUTO_TEST_CASE(smoke_test) BOOST_CHECK(containsAtMostWarnings(result)); } +BOOST_AUTO_TEST_CASE(optimizer_enabled_not_boolean) +{ + char const* input = R"( + { + "language": "Solidity", + "settings": { + "optimizer": { + "enabled": "wrong" + } + }, + "sources": { + "empty": { + "content": "" + } + } + } + )"; + Json::Value result = compile(input); + BOOST_CHECK(containsError(result, "JSONError", "The \"enabled\" setting must be a boolean.")); +} + +BOOST_AUTO_TEST_CASE(optimizer_runs_not_a_number) +{ + char const* input = R"( + { + "language": "Solidity", + "settings": { + "optimizer": { + "enabled": true, + "runs": "not a number" + } + }, + "sources": { + "empty": { + "content": "" + } + } + } + )"; + Json::Value result = compile(input); + BOOST_CHECK(containsError(result, "JSONError", "The \"runs\" setting must be an unsigned number.")); +} + +BOOST_AUTO_TEST_CASE(optimizer_runs_not_an_unsigned_number) +{ + char const* input = R"( + { + "language": "Solidity", + "settings": { + "optimizer": { + "enabled": true, + "runs": -1 + } + }, + "sources": { + "empty": { + "content": "" + } + } + } + )"; + Json::Value result = compile(input); + BOOST_CHECK(containsError(result, "JSONError", "The \"runs\" setting must be an unsigned number.")); +} + BOOST_AUTO_TEST_CASE(basic_compilation) { char const* input = R"( @@ -640,7 +705,7 @@ BOOST_AUTO_TEST_CASE(libraries_invalid_entry) } )"; Json::Value result = compile(input); - BOOST_CHECK(containsError(result, "JSONError", "library entry is not a JSON object.")); + BOOST_CHECK(containsError(result, "JSONError", "Library entry is not a JSON object.")); } BOOST_AUTO_TEST_CASE(libraries_invalid_hex) |