Browse Source

testeth: support for --singletest option with only test name param.

cl-refactor
Paweł Bylica 10 years ago
parent
commit
03a82e401c
  1. 21
      test/TestHelper.cpp

21
test/TestHelper.cpp

@ -552,6 +552,9 @@ void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _e
void userDefinedTest(std::function<void(json_spirit::mValue&, bool)> doTests) void userDefinedTest(std::function<void(json_spirit::mValue&, bool)> doTests)
{ {
if (!Options::get().singleTest) if (!Options::get().singleTest)
return;
if (Options::get().singleTestFile.empty() || Options::get().singleTestName.empty())
{ {
cnote << "Missing user test specification\nUsage: testeth --singletest <filename> <testname>\n"; cnote << "Missing user test specification\nUsage: testeth --singletest <filename> <testname>\n";
return; return;
@ -732,11 +735,23 @@ Options::Options()
inputLimits = true; inputLimits = true;
bigData = true; bigData = true;
} }
else if (arg == "--singletest" && i + 2 < argc) else if (arg == "--singletest" && i + 1 < argc)
{ {
singleTest = true; singleTest = true;
singleTestFile = argv[i + 1]; auto name1 = std::string{argv[i + 1]};
singleTestName = argv[i + 2]; if (i + 1 < argc) // two params
{
auto name2 = std::string{argv[i + 2]};
if (name2[0] == '-') // not param, another option
singleTestName = std::move(name1);
else
{
singleTestFile = std::move(name1);
singleTestName = std::move(name2);
}
}
else
singleTestName = std::move(name1);
} }
} }
} }

Loading…
Cancel
Save