mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #533 from CJentzsch/stateTests
Specify user defined test
This commit is contained in:
commit
d2ea1d7cc6
@ -322,12 +322,13 @@ void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue
|
||||
string arg = boost::unit_test::framework::master_test_suite().argv[i];
|
||||
if (arg == testTypeFlag)
|
||||
{
|
||||
if (i + 1 >= boost::unit_test::framework::master_test_suite().argc)
|
||||
if (boost::unit_test::framework::master_test_suite().argc <= i + 2)
|
||||
{
|
||||
cnote << "Missing filename\nUsage: testeth " << testTypeFlag << " <filename>\n";
|
||||
cnote << "Missing filename\nUsage: testeth " << testTypeFlag << " <filename> <testname>\n";
|
||||
return;
|
||||
}
|
||||
string filename = boost::unit_test::framework::master_test_suite().argv[i + 1];
|
||||
string testname = boost::unit_test::framework::master_test_suite().argv[i + 2];
|
||||
int currentVerbosity = g_logVerbosity;
|
||||
g_logVerbosity = 12;
|
||||
try
|
||||
@ -337,7 +338,19 @@ void userDefinedTest(string testTypeFlag, std::function<void(json_spirit::mValue
|
||||
string s = asString(contents(filename));
|
||||
BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + filename + " is empty. ");
|
||||
json_spirit::read_string(s, v);
|
||||
doTests(v, false);
|
||||
json_spirit::mObject oSingleTest;
|
||||
|
||||
json_spirit::mObject::const_iterator pos = v.get_obj().find(testname);
|
||||
if (pos == v.get_obj().end())
|
||||
{
|
||||
cnote << "Could not find test: " << testname << " in " << filename << "\n";
|
||||
return;
|
||||
}
|
||||
else
|
||||
oSingleTest[pos->first] = pos->second;
|
||||
|
||||
json_spirit::mValue v_singleTest(oSingleTest);
|
||||
doTests(v_singleTest, false);
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user