From 55600f2c519bcafc657c73197f502f30be632743 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 19 Jul 2017 13:45:00 +0100 Subject: Add test for compileStandard --- test/libsolidity/JSONCompiler.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/libsolidity/JSONCompiler.cpp b/test/libsolidity/JSONCompiler.cpp index cebace88..536ba730 100644 --- a/test/libsolidity/JSONCompiler.cpp +++ b/test/libsolidity/JSONCompiler.cpp @@ -38,6 +38,7 @@ extern char const* license(); extern char const* compileJSON(char const* _input, bool _optimize); extern char const* compileJSONMulti(char const* _input, bool _optimize); extern char const* compileJSONCallback(char const* _input, bool _optimize, void* _readCallback); +extern char const* compileStandard(char const* _input, void* _readCallback); } namespace dev @@ -70,6 +71,14 @@ Json::Value compileMulti(string const& _input, bool _callback) return ret; } +Json::Value compile(string const& _input) +{ + string output(compileStandard(_input.c_str(), NULL)); + Json::Value ret; + BOOST_REQUIRE(Json::Reader().parse(output, ret, false)); + return ret; +} + } // end anonymous namespace BOOST_AUTO_TEST_SUITE(JSONCompiler) @@ -183,6 +192,26 @@ BOOST_AUTO_TEST_CASE(single_compilation) ); } +BOOST_AUTO_TEST_CASE(standard_compilation) +{ + char const* input = R"( + { + "language": "Solidity", + "sources": { + "fileA": { + "content": "contract A { }" + } + } + } + )"; + Json::Value result = compile(input); + BOOST_CHECK(result.isObject()); + + // Only tests some assumptions. The StandardCompiler is tested properly in another suite. + BOOST_CHECK(result.isMember("sources")); + BOOST_CHECK(result.isMember("contracts")); +} + BOOST_AUTO_TEST_SUITE_END() } -- cgit v1.2.3