diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-19 20:45:00 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-07-19 20:45:00 +0800 |
commit | 55600f2c519bcafc657c73197f502f30be632743 (patch) | |
tree | 1b1e1ef407a265917fdd19d8715945fe74e59272 /test | |
parent | bcd19456f49c15bf6f3dd9d8bb7e4cb3dab24ecf (diff) | |
download | dexon-solidity-55600f2c519bcafc657c73197f502f30be632743.tar.gz dexon-solidity-55600f2c519bcafc657c73197f502f30be632743.tar.zst dexon-solidity-55600f2c519bcafc657c73197f502f30be632743.zip |
Add test for compileStandard
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/JSONCompiler.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
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() } |