Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cschreib committed Aug 12, 2023
1 parent 95fa1da commit 6047a0f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/snitch/snitch_catch2_xml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct reporter {
explicit reporter(registry& r) noexcept {
// The XML reporter needs test_case_started and test_case_ended events, which are only
// printed on verbosity 'high', so ensure the requested verbosity is at least as much.
r.verbose = r.verbose < registry::verbosity::full ? registry::verbosity::full : r.verbose;
r.verbose = r.verbose < registry::verbosity::high ? registry::verbosity::high : r.verbose;
}

bool configure(registry&, std::string_view, std::string_view) noexcept {
Expand Down Expand Up @@ -164,7 +164,7 @@ struct reporter {
}},
e.data);

for (const auto& s : e.sections) {
for (const auto& s [[maybe_unused]] : e.sections) {
close(r, "Section");
}
}
Expand Down
21 changes: 19 additions & 2 deletions tests/testing_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,29 @@ template<typename T>
void copy_full_location(event_deep_copy& c, const T& e) {
append_or_truncate(c.location_file, e.location.file);
c.location_line = e.location.line;
append_or_truncate(c.message, e.message);

if constexpr (std::is_same_v<T, snitch::event::test_case_skipped>) {
append_or_truncate(c.message, e.message);
} else {
std::visit(
snitch::overload{
[&](std::string_view message) { append_or_truncate(c.message, message); },
[&](const snitch::expression_info& exp) {
if (!exp.actual.empty()) {
append_or_truncate(
c.message, exp.type, "(", exp.expected, "), got ", exp.actual);
} else {
append_or_truncate(c.message, exp.expected);
}
}},
e.data);
}

for (const auto& ec : e.captures) {
c.captures.push_back(ec);
}
for (const auto& es : e.sections) {
c.sections.push_back(es.name);
c.sections.push_back(es.id.name);
}
}

Expand Down

0 comments on commit 6047a0f

Please sign in to comment.