diff options
author | chriseth <chris@ethereum.org> | 2018-10-09 21:25:28 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-10-11 21:01:43 +0800 |
commit | 9081f803c7d27158d92ddc35a7c39bb76ad63268 (patch) | |
tree | a49408ed72d994e22907bec573e2c229b68ce95d | |
parent | 51db4f5411d29f2c0569066ea792b752827f4aec (diff) | |
download | dexon-solidity-9081f803c7d27158d92ddc35a7c39bb76ad63268.tar.gz dexon-solidity-9081f803c7d27158d92ddc35a7c39bb76ad63268.tar.zst dexon-solidity-9081f803c7d27158d92ddc35a7c39bb76ad63268.zip |
Extract function.
-rw-r--r-- | test/tools/isoltest.cpp | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index ad6b456d..cc7e706d 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -256,6 +256,9 @@ TestStats TestTool::processPath( } +namespace +{ + void setupTerminal() { #if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING) @@ -276,6 +279,27 @@ void setupTerminal() #endif } +fs::path discoverTestPath() +{ + auto const searchPath = + { + fs::current_path() / ".." / ".." / ".." / "test", + fs::current_path() / ".." / ".." / "test", + fs::current_path() / ".." / "test", + fs::current_path() / "test", + fs::current_path() + }; + for (auto const& basePath: searchPath) + { + fs::path syntaxTestPath = basePath / "libsolidity" / "syntaxTests"; + if (fs::exists(syntaxTestPath) && fs::is_directory(syntaxTestPath)) + return basePath; + } + return {}; +} + +} + int main(int argc, char *argv[]) { setupTerminal(); @@ -326,25 +350,7 @@ Allowed options)", } if (testPath.empty()) - { - auto const searchPath = - { - fs::current_path() / ".." / ".." / ".." / "test", - fs::current_path() / ".." / ".." / "test", - fs::current_path() / ".." / "test", - fs::current_path() / "test", - fs::current_path() - }; - for (auto const& basePath : searchPath) - { - fs::path syntaxTestPath = basePath / "libsolidity" / "syntaxTests"; - if (fs::exists(syntaxTestPath) && fs::is_directory(syntaxTestPath)) - { - testPath = basePath; - break; - } - } - } + testPath = discoverTestPath(); TestStats global_stats { 0, 0 }; |