|
25 | 25 | #include <test/InteractiveTests.h>
|
26 | 26 | #include <test/EVMHost.h>
|
27 | 27 |
|
| 28 | +#include <boost/algorithm/string/predicate.hpp> |
28 | 29 | #include <boost/algorithm/string/replace.hpp>
|
29 | 30 | #include <boost/filesystem.hpp>
|
30 | 31 |
|
| 32 | +#include <fmt/format.h> |
| 33 | + |
| 34 | +#include <range/v3/algorithm/all_of.hpp> |
| 35 | + |
31 | 36 | #include <cstdlib>
|
32 | 37 | #include <iostream>
|
33 | 38 | #include <queue>
|
@@ -65,14 +70,17 @@ struct TestStats
|
65 | 70 | class TestFilter
|
66 | 71 | {
|
67 | 72 | public:
|
68 |
| - explicit TestFilter(std::string _filter): m_filter(std::move(_filter)) |
| 73 | + explicit TestFilter(std::string _filter): |
| 74 | + m_filter(std::move(_filter)) |
69 | 75 | {
|
70 |
| - std::string filter{m_filter}; |
71 |
| - |
72 |
| - boost::replace_all(filter, "/", "\\/"); |
73 |
| - boost::replace_all(filter, "*", ".*"); |
74 |
| - |
75 |
| - m_filterExpression = std::regex{"(" + filter + "(\\.sol|\\.yul|\\.asm|\\.asmjson|\\.stack))"}; |
| 76 | + auto const startsWithDot = [](std::string const& _extension) { return boost::starts_with(_extension, "."); }; |
| 77 | + soltestAssert(ranges::all_of(testFileExtensions(), startsWithDot)); |
| 78 | + |
| 79 | + m_filterExpression = std::regex{fmt::format( |
| 80 | + "({}({}))", |
| 81 | + boost::replace_all_copy(boost::replace_all_copy(m_filter, "/", "\\/"), "*", ".*"), |
| 82 | + boost::replace_all_copy(joinHumanReadable(testFileExtensions(), "|"), ".", "\\.") |
| 83 | + )}; |
76 | 84 | }
|
77 | 85 |
|
78 | 86 | bool matches(fs::path const& _path, std::string const& _name) const
|
|
0 commit comments