aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/StandardCompiler.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-02-22 21:47:36 +0800
committerchriseth <chris@ethereum.org>2018-03-02 00:19:35 +0800
commit60f7be5d4cee94935ad35e3ebacd419e5b52ecce (patch)
treecd4d7fd04eb790b46c0c0f00f0e86e821bea65b4 /test/libsolidity/StandardCompiler.cpp
parentf75a41132553d073202d8bc2ea65cc287c7085b7 (diff)
downloaddexon-solidity-60f7be5d4cee94935ad35e3ebacd419e5b52ecce.tar.gz
dexon-solidity-60f7be5d4cee94935ad35e3ebacd419e5b52ecce.tar.zst
dexon-solidity-60f7be5d4cee94935ad35e3ebacd419e5b52ecce.zip
Some tests.
Diffstat (limited to 'test/libsolidity/StandardCompiler.cpp')
-rw-r--r--test/libsolidity/StandardCompiler.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/libsolidity/StandardCompiler.cpp b/test/libsolidity/StandardCompiler.cpp
index eb2773ba..df3ece7c 100644
--- a/test/libsolidity/StandardCompiler.cpp
+++ b/test/libsolidity/StandardCompiler.cpp
@@ -724,6 +724,39 @@ BOOST_AUTO_TEST_CASE(library_linking)
BOOST_CHECK(contract["evm"]["bytecode"]["linkReferences"]["library2.sol"]["L2"][0].isObject());
}
+BOOST_AUTO_TEST_CASE(evm_version)
+{
+ auto inputForVersion = [](string const& _version)
+ {
+ return R"(
+ {
+ "language": "Solidity",
+ "sources": { "fileA": { "content": "contract A { }" } },
+ "settings": {
+ )" + _version + R"(
+ "outputSelection": {
+ "fileA": {
+ "A": [ "metadata" ]
+ }
+ }
+ }
+ }
+ )";
+ };
+ Json::Value result;
+ result = compile(inputForVersion("\"evmVersion\": \"homestead\","));
+ BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"homestead\"") != string::npos);
+ result = compile(inputForVersion("\"evmVersion\": \"byzantium\","));
+ BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"byzantium\"") != string::npos);
+ // test default
+ result = compile(inputForVersion(""));
+ BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"byzantium\"") != string::npos);
+ // test invalid
+ result = compile(inputForVersion("\"evmVersion\": \"invalid\","));
+ BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested.");
+}
+
+
BOOST_AUTO_TEST_SUITE_END()
}