From 669df0d1e5cc914117d17aab06b7a93ec23aeaf9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Apr 2019 11:45:51 +0200 Subject: [PATCH] Allow more filters and rename member. --- test/tools/IsolTestOptions.cpp | 9 +++++---- test/tools/IsolTestOptions.h | 2 +- test/tools/isoltest.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/tools/IsolTestOptions.cpp b/test/tools/IsolTestOptions.cpp index 99b21eebd..5b875393d 100644 --- a/test/tools/IsolTestOptions.cpp +++ b/test/tools/IsolTestOptions.cpp @@ -59,7 +59,7 @@ IsolTestOptions::IsolTestOptions(std::string* _editor): ("editor", po::value(_editor)->default_value(editorPath()), "Path to editor for opening test files.") ("help", po::bool_switch(&showHelp), "Show this help screen.") ("no-color", po::bool_switch(&noColor), "Don't use colors.") - ("test,t", po::value(&test)->default_value("*/*"), "Filters which test units to include."); + ("test,t", po::value(&testFilter)->default_value("*/*"), "Filters which test units to include."); } bool IsolTestOptions::parse(int _argc, char const* const* _argv) @@ -77,11 +77,12 @@ bool IsolTestOptions::parse(int _argc, char const* const* _argv) void IsolTestOptions::validate() const { - std::regex filterExpression{"(((\\*+|\\w+|\\w+\\*+)\\/)+(\\*|\\w+\\**))"}; + static std::string filterString{"[a-zA-Z1-9_/*]*"}; + static std::regex filterExpression{filterString}; assertThrow( - regex_match(test, filterExpression), + regex_match(testFilter, filterExpression), ConfigException, - "Invalid test unit filter: " + test + "Invalid test unit filter - can only contain '" + filterString + ": " + testFilter ); } diff --git a/test/tools/IsolTestOptions.h b/test/tools/IsolTestOptions.h index 204be9a28..e77e623f1 100644 --- a/test/tools/IsolTestOptions.h +++ b/test/tools/IsolTestOptions.h @@ -32,7 +32,7 @@ struct IsolTestOptions: CommonOptions { bool showHelp = false; bool noColor = false; - std::string test = std::string{}; + std::string testFilter = std::string{}; IsolTestOptions(std::string* _editor); bool parse(int _argc, char const* const* _argv) override; diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp index 1e92b6bac..f51b2300d 100644 --- a/test/tools/isoltest.cpp +++ b/test/tools/isoltest.cpp @@ -98,7 +98,7 @@ public: ): m_testCaseCreator(_testCaseCreator), m_options(_options), - m_filter(TestFilter{_options.test}), + m_filter(TestFilter{_options.testFilter}), m_path(_path), m_name(_name) {}