mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add test for compileStandard
This commit is contained in:
parent
bcd19456f4
commit
55600f2c51
@ -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()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user