mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'origin/develop' into develop_060
This commit is contained in:
@@ -69,47 +69,6 @@ BOOST_AUTO_TEST_CASE(json_compact_print)
|
||||
BOOST_CHECK("{\"1\":1,\"2\":\"2\",\"3\":{\"3.1\":\"3.1\",\"3.2\":2}}" == jsonCompactPrint(json));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_json_not_strict)
|
||||
{
|
||||
Json::Value json;
|
||||
std::string errors;
|
||||
|
||||
// just parse a valid json input
|
||||
BOOST_CHECK(jsonParse("{\"1\":1,\"2\":\"2\",\"3\":{\"3.1\":\"3.1\",\"3.2\":2}}", json, &errors));
|
||||
BOOST_CHECK(json["1"] == 1);
|
||||
BOOST_CHECK(json["2"] == "2");
|
||||
BOOST_CHECK(json["3"]["3.1"] == "3.1");
|
||||
BOOST_CHECK(json["3"]["3.2"] == 2);
|
||||
|
||||
// trailing garbage is allowed here
|
||||
BOOST_CHECK(jsonParse("{\"1\":2,\"2\":\"2\",\"3\":{\"3.1\":\"3.1\",\"3.2\":3}}}}}}}}}}", json, &errors));
|
||||
BOOST_CHECK(json["1"] == 2);
|
||||
BOOST_CHECK(json["2"] == "2");
|
||||
BOOST_CHECK(json["3"]["3.1"] == "3.1");
|
||||
BOOST_CHECK(json["3"]["3.2"] == 3);
|
||||
|
||||
// comments are allowed
|
||||
BOOST_CHECK(jsonParse(
|
||||
"{\"1\":3, // awesome comment\n\"2\":\"2\",\"3\":{\"3.1\":\"3.1\",\"3.2\":4}}", json, &errors
|
||||
));
|
||||
BOOST_CHECK(json["1"] == 3);
|
||||
BOOST_CHECK(json["2"] == "2");
|
||||
BOOST_CHECK(json["3"]["3.1"] == "3.1");
|
||||
BOOST_CHECK(json["3"]["3.2"] == 4);
|
||||
|
||||
// root element other than object or array is allowed
|
||||
BOOST_CHECK(jsonParse("[]", json, &errors));
|
||||
BOOST_CHECK(jsonParse("{}", json, &errors));
|
||||
BOOST_CHECK(jsonParse("1", json, &errors));
|
||||
BOOST_CHECK(json == 1);
|
||||
BOOST_CHECK(jsonParse("\"hello\"", json, &errors));
|
||||
BOOST_CHECK(json == "hello");
|
||||
|
||||
// non-UTF-8 escapes allowed
|
||||
BOOST_CHECK(jsonParse("[ \"\x80\xec\x80\" ]", json, &errors));
|
||||
BOOST_CHECK(json[0] == "\x80\xec\x80");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(parse_json_strict)
|
||||
{
|
||||
Json::Value json;
|
||||
|
||||
@@ -268,7 +268,7 @@ BOOST_AUTO_TEST_CASE(metadata_useLiteralContent)
|
||||
BOOST_REQUIRE_MESSAGE(compilerStack.compile(), "Compiling contract failed");
|
||||
string metadata_str = compilerStack.metadata("test");
|
||||
Json::Value metadata;
|
||||
jsonParse(metadata_str, metadata);
|
||||
jsonParseStrict(metadata_str, metadata);
|
||||
BOOST_CHECK(dev::test::isValidMetadata(metadata_str));
|
||||
BOOST_CHECK(metadata.isMember("settings"));
|
||||
BOOST_CHECK(metadata["settings"].isMember("metadata"));
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <test/libsolidity/SMTCheckerJSONTest.h>
|
||||
#include <test/Options.h>
|
||||
#include <libsolidity/interface/StandardCompiler.h>
|
||||
#include <libdevcore/CommonIO.h>
|
||||
#include <libdevcore/JSON.h>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
@@ -43,7 +44,7 @@ SMTCheckerTest::SMTCheckerTest(string const& _filename, langutil::EVMVersion _ev
|
||||
|
||||
string jsonFilename = _filename.substr(0, _filename.size() - 4) + ".json";
|
||||
if (
|
||||
!jsonParseFile(jsonFilename, m_smtResponses) ||
|
||||
!jsonParseStrict(readFileAsString(jsonFilename), m_smtResponses) ||
|
||||
!m_smtResponses.isObject()
|
||||
)
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Invalid JSON file."));
|
||||
@@ -158,7 +159,7 @@ Json::Value SMTCheckerTest::buildJson(string const& _extra)
|
||||
sources += "}";
|
||||
string input = "{" + language + ", " + sources + "}";
|
||||
Json::Value source;
|
||||
if (!jsonParse(input, source))
|
||||
if (!jsonParseStrict(input, source))
|
||||
BOOST_THROW_EXCEPTION(runtime_error("Could not build JSON from string: " + input));
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -1199,7 +1199,9 @@ BOOST_AUTO_TEST_CASE(use_stack_optimization)
|
||||
result = compiler.compile(parsedInput);
|
||||
BOOST_REQUIRE(result["errors"].isArray());
|
||||
BOOST_CHECK(result["errors"][0]["severity"] == "error");
|
||||
BOOST_CHECK(result["errors"][0]["type"] == "InternalCompilerError");
|
||||
BOOST_REQUIRE(result["errors"][0]["message"].isString());
|
||||
BOOST_CHECK(result["errors"][0]["message"].asString().find("Stack too deep when compiling inline assembly") != std::string::npos);
|
||||
BOOST_CHECK(result["errors"][0]["type"] == "YulException");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(standard_output_selection_wildcard)
|
||||
|
||||
@@ -12,6 +12,5 @@ contract C {
|
||||
// Warning: (206-209): Assertion checker does not yet implement type abi
|
||||
// Warning: (225-226): Assertion checker does not yet implement type type(struct C.S storage pointer)
|
||||
// Warning: (235-241): Assertion checker does not yet implement type type(uint256[] memory)
|
||||
// Warning: (235-241): Assertion checker does not yet implement this expression.
|
||||
// Warning: (235-244): Assertion checker does not yet implement type type(uint256[] memory[2] memory)
|
||||
// Warning: (206-246): Assertion checker does not yet implement this type of function call.
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
pragma experimental SMTChecker;
|
||||
contract test {
|
||||
struct s { uint a; uint b;}
|
||||
function f() pure public returns (byte) {
|
||||
s;
|
||||
s(1,2);
|
||||
s[7];
|
||||
uint;
|
||||
uint[7];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (125-126): Statement has no effect.
|
||||
// Warning: (130-136): Statement has no effect.
|
||||
// Warning: (140-144): Statement has no effect.
|
||||
// Warning: (148-152): Statement has no effect.
|
||||
// Warning: (156-163): Statement has no effect.
|
||||
// Warning: (125-126): Assertion checker does not yet implement type type(struct test.s storage pointer)
|
||||
// Warning: (130-131): Assertion checker does not yet implement type type(struct test.s storage pointer)
|
||||
// Warning: (130-136): Assertion checker does not yet implement type struct test.s memory
|
||||
// Warning: (130-136): Assertion checker does not yet implement this expression.
|
||||
// Warning: (140-141): Assertion checker does not yet implement type type(struct test.s storage pointer)
|
||||
// Warning: (140-144): Assertion checker does not yet implement type type(struct test.s memory[7] memory)
|
||||
// Warning: (156-163): Assertion checker does not yet implement type type(uint256[7] memory)
|
||||
@@ -7,5 +7,4 @@ function f() public pure { int[][]; }
|
||||
// ----
|
||||
// Warning: (73-80): Statement has no effect.
|
||||
// Warning: (73-78): Assertion checker does not yet implement type type(int256[] memory)
|
||||
// Warning: (73-78): Assertion checker does not yet implement this expression.
|
||||
// Warning: (73-80): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
|
||||
@@ -7,6 +7,5 @@ function f() public pure { int[][][]; }
|
||||
// ----
|
||||
// Warning: (73-82): Statement has no effect.
|
||||
// Warning: (73-78): Assertion checker does not yet implement type type(int256[] memory)
|
||||
// Warning: (73-78): Assertion checker does not yet implement this expression.
|
||||
// Warning: (73-80): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
// Warning: (73-82): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory)
|
||||
|
||||
@@ -7,6 +7,5 @@ function f() public pure { (int[][]); }
|
||||
// ----
|
||||
// Warning: (73-82): Statement has no effect.
|
||||
// Warning: (74-79): Assertion checker does not yet implement type type(int256[] memory)
|
||||
// Warning: (74-79): Assertion checker does not yet implement this expression.
|
||||
// Warning: (74-81): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
// Warning: (73-82): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
|
||||
@@ -7,7 +7,6 @@ function f() public pure { (int[][][]); }
|
||||
// ----
|
||||
// Warning: (73-84): Statement has no effect.
|
||||
// Warning: (74-79): Assertion checker does not yet implement type type(int256[] memory)
|
||||
// Warning: (74-79): Assertion checker does not yet implement this expression.
|
||||
// Warning: (74-81): Assertion checker does not yet implement type type(int256[] memory[] memory)
|
||||
// Warning: (74-83): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory)
|
||||
// Warning: (73-84): Assertion checker does not yet implement type type(int256[] memory[] memory[] memory)
|
||||
|
||||
Reference in New Issue
Block a user