aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/StandardCompiler.cpp
diff options
context:
space:
mode:
authorAlexander Arlt <alexander.arlt@arlt-labs.com>2018-02-14 04:40:16 +0800
committerAlexander Arlt <alexander.arlt@arlt-labs.com>2018-02-17 01:44:46 +0800
commit1d4547ab037db2f21fcb31219ae28a1d295ab270 (patch)
tree59d3cb61d7b4e470960eb87aa946fb6e24062b3c /test/libsolidity/StandardCompiler.cpp
parent3f7e82d00ba6b0a9c1e7644b8613aa2126498893 (diff)
downloaddexon-solidity-1d4547ab037db2f21fcb31219ae28a1d295ab270.tar.gz
dexon-solidity-1d4547ab037db2f21fcb31219ae28a1d295ab270.tar.zst
dexon-solidity-1d4547ab037db2f21fcb31219ae28a1d295ab270.zip
Minor improvement: check sources
- returns error, if "sources" is an array, an empty object or not defined - Added new test-cases in test/libsolidity/StandardCompiler.cpp
Diffstat (limited to 'test/libsolidity/StandardCompiler.cpp')
-rw-r--r--test/libsolidity/StandardCompiler.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp
index e48624e5..8da536d8 100644
--- a/test/libsolidity/StandardCompiler.cpp
+++ b/test/libsolidity/StandardCompiler.cpp
@@ -154,6 +154,42 @@ BOOST_AUTO_TEST_CASE(no_sources)
BOOST_CHECK(containsError(result, "JSONError", "No input sources specified."));
}
+BOOST_AUTO_TEST_CASE(no_sources_empty_object)
+{
+ char const* input = R"(
+ {
+ "language": "Solidity",
+ "sources": {}
+ }
+ )";
+ Json::Value result = compile(input);
+ BOOST_CHECK(containsError(result, "JSONError", "No input sources specified."));
+}
+
+BOOST_AUTO_TEST_CASE(no_sources_empty_array)
+{
+ char const* input = R"(
+ {
+ "language": "Solidity",
+ "sources": []
+ }
+ )";
+ Json::Value result = compile(input);
+ BOOST_CHECK(containsError(result, "JSONError", "\"sources\" is not a JSON object."));
+}
+
+BOOST_AUTO_TEST_CASE(sources_is_array)
+{
+ char const* input = R"(
+ {
+ "language": "Solidity",
+ "sources": ["aa", "bb"]
+ }
+ )";
+ Json::Value result = compile(input);
+ BOOST_CHECK(containsError(result, "JSONError", "\"sources\" is not a JSON object."));
+}
+
BOOST_AUTO_TEST_CASE(smoke_test)
{
char const* input = R"(