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

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft/Runner/ResultImportTap.cpp
diff options
context:
space:
mode:
authorLeitwolf112026-11-01 14:48:55 +0300
committerLeitwolf112026-11-01 14:48:55 +0300
commit569620dad14df7e13bb9fd31d256e9fd873ef6ec (patch)
treef933300c29658c3eb89d126d74b6c30fdff9dd04 /src/Progmasoft/Runner/ResultImportTap.cpp
parent1db203d56b7c71db3d80b477da1ad49e9ae46468 (diff)
downloadcatch3-feature/result-import.tar.gz
Keep real failures visible when importingfeature/result-import
A review of the import found ways for a failure to disappear or for the import to reach too far. - CTRF's retryAttempts ends before the final attempt, which was dropped when its outcome matched the one before it. - TAP names tests only within a stream, so a failure in one file and a pass under the same name in another merged into a flaky pass. The path given to --import is now the class of a stream's tests. - A failure followed by a skip with the same identifier read as skipped. - Directives are whole words: TODOING is not TODO. SKIPPED and SKIPPING stay directives, as harnesses treat them. - Verdicts that alternate count as flaky only under an explicit --import-revision. HEAD says nothing about a dirty checkout or a report from another one, and two such events could quarantine a real failure. - --import-name no longer redirects the history of a normal test run. - Importing does not depend on the tests registered in the binary.
Diffstat (limited to 'src/Progmasoft/Runner/ResultImportTap.cpp')
-rw-r--r--src/Progmasoft/Runner/ResultImportTap.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/Progmasoft/Runner/ResultImportTap.cpp b/src/Progmasoft/Runner/ResultImportTap.cpp
index a5f44046..b127701c 100644
--- a/src/Progmasoft/Runner/ResultImportTap.cpp
+++ b/src/Progmasoft/Runner/ResultImportTap.cpp
@@ -113,15 +113,20 @@ namespace Progmasoft::Catch3::Runner
{
const std::string_view rest
= ImportTrim(text.substr(directive + 1));
- const std::string word = Lowered(rest.substr(0, 4));
- if (word == "skip" || word == "todo")
+ const auto end = rest.find_first_of(" \t:");
+ const std::string word = Lowered(rest.substr(0, end));
+ // Harnesses take the longer spellings of SKIP, and only
+ // the word TODO.
+ if (word == "skip" || word == "skipped"
+ || word == "skipping" || word == "todo")
{
- line.directive = word;
- const auto space = rest.find_first_of(" \t");
- line.reason = space == std::string_view::npos
- ? std::string{}
- : std::string{ ImportTrim(
- rest.substr(space)) };
+ line.directive = word.substr(0, 4);
+ if (end != std::string_view::npos)
+ {
+ std::string_view reason = rest.substr(end);
+ reason.remove_prefix(reason.front() == ':' ? 1 : 0);
+ line.reason = std::string{ ImportTrim(reason) };
+ }
}
}
return line;
@@ -184,7 +189,7 @@ namespace Progmasoft::Catch3::Runner
}
Expected<std::vector<TestResult>>
- Parse(std::string_view text)
+ Parse(std::string_view text, const std::string &source)
{
std::vector<TestResult> tests;
std::vector<std::string> subtests;
@@ -265,7 +270,7 @@ namespace Progmasoft::Catch3::Runner
}
anything = true;
topLevel += depth == 0 ? 1 : 0;
- std::string parent;
+ std::string parent = source;
for (std::size_t level = 0;
level < std::min(depth, subtests.size());
++level)
@@ -310,7 +315,7 @@ namespace Progmasoft::Catch3::Runner
}
if (!incomplete.empty())
{
- TestResult test = ImportedTest("the TAP stream", {});
+ TestResult test = ImportedTest("the TAP stream", source);
test.attempts.push_back(
ImportedAttempt(Outcome::kFailed,
0,
@@ -331,8 +336,8 @@ namespace Progmasoft::Catch3::Runner
}
Expected<std::vector<TestResult>>
- ParseTap(std::string_view text)
+ ParseTap(std::string_view text, const std::string &source)
{
- return ImportTap::Parse(text);
+ return ImportTap::Parse(text, source);
}
} // namespace Progmasoft::Catch3::Runner