diff options
author | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-05-12 15:37:39 +0800 |
---|---|---|
committer | Paweł Bylica <pawel.bylica@imapp.pl> | 2015-05-12 15:37:39 +0800 |
commit | 2e169a99472ec8e2f9b4f4cc7ab12fb90a598e5b (patch) | |
tree | c4ad6955417538f8be4025f5e21206a8ef0c14b5 /TestHelper.cpp | |
parent | f7109717ed6ffbde00cbd9090cdb6e8f00c01359 (diff) | |
download | dexon-solidity-2e169a99472ec8e2f9b4f4cc7ab12fb90a598e5b.tar.gz dexon-solidity-2e169a99472ec8e2f9b4f4cc7ab12fb90a598e5b.tar.zst dexon-solidity-2e169a99472ec8e2f9b4f4cc7ab12fb90a598e5b.zip |
testeth: support for --singletest option with only test name param.
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index e0aad310..1d7734e3 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -552,6 +552,9 @@ void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _e void userDefinedTest(std::function<void(json_spirit::mValue&, bool)> doTests) { 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"; return; @@ -732,11 +735,23 @@ Options::Options() inputLimits = true; bigData = true; } - else if (arg == "--singletest" && i + 2 < argc) + else if (arg == "--singletest" && i + 1 < argc) { singleTest = true; - singleTestFile = argv[i + 1]; - singleTestName = argv[i + 2]; + auto name1 = std::string{argv[i + 1]}; + 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); } } } |