Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include/internal/catch_session.cpp
diff options
context:
space:
mode:
authoramitherman952019-10-19 16:50:46 +0300
committerJozef Grajciar2019-10-19 21:14:06 +0200
commit84856844e17f78e9f3a9f113df9d3ff23aad69e1 (patch)
tree2f2a85bf82fab59fe431ea80ffc85a102a261eb9 /include/internal/catch_session.cpp
parent01ef7076f50f5f2b481ddf082e1afca3c926983f (diff)
downloadcatch3-84856844e17f78e9f3a9f113df9d3ff23aad69e1.tar.gz
Fixes #1766: Catch terminates when parsing invalid test name
Diffstat (limited to 'include/internal/catch_session.cpp')
-rw-r--r--include/internal/catch_session.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/internal/catch_session.cpp b/include/internal/catch_session.cpp
index 94db4597..b1d7a404 100644
--- a/include/internal/catch_session.cpp
+++ b/include/internal/catch_session.cpp
@@ -68,8 +68,9 @@ namespace Catch {
{
auto const& allTestCases = getAllTestCasesSorted(*m_config);
m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config);
-
- if (m_matches.empty()) {
+ auto const& invalidArgs = m_config->testSpec().getInvalidArgs();
+
+ if (m_matches.empty() && invalidArgs.empty()) {
for (auto const& test : allTestCases)
if (!test.isHidden())
m_tests.emplace(&test);
@@ -80,6 +81,7 @@ namespace Catch {
}
Totals execute() {
+ auto const& invalidArgs = m_config->testSpec().getInvalidArgs();
Totals totals;
m_context.testGroupStarting(m_config->name(), 1, 1);
for (auto const& testCase : m_tests) {
@@ -95,6 +97,12 @@ namespace Catch {
totals.error = -1;
}
}
+
+ if (!invalidArgs.empty()) {
+ for (auto const& invalidArg: invalidArgs)
+ m_context.reporter().reportInvalidArguments(invalidArg);
+ }
+
m_context.testGroupEnded(m_config->name(), totals, 1, 1);
return totals;
}