Output hint in assertionEnded on assert
- Dominant language
- C++
- Stars
- 21.5k
- Forks
- 3.5k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 2
Description
I've spent quite some time to figure out the crash occurring below when my app is built for CodeCoverage. It turned out that after refactoring, a helper method ended up in the test main which had a CATCH_REQUIRE with no test case. All tests passed, but finding that culprit took time.
Is it possible to print additional info about the likely cause, before the assert is triggered in assertionEnded()?
```
app-tests: /var/jenkins_home/workspace/build-fix/test/catch.hpp:5894: bool Catch::CumulativeReporterBase::assertionEnded(const Catch::AssertionStats&) [with DerivedT = Catch::JunitReporter]: Assertion `!m_sectionStack.empty()' failed.
*** Aborted at 1606566929 (unix time) try "date -d @1606566929" if you are using GNU date ***
PC: @ 0x0 (unknown)
*** SIGABRT (@0x3ea00000531) received by PID 1329 (TID 0x7f99196950c0) from PID 1329; stack trace: ***
@ 0x5620786d3206 google::(anonymous namespace)::FailureSignalHandler()
@ 0x7f991a2ca3c0 (unknown)
@ 0x7f99196df18b gsignal
@ 0x7f99196be859 abort
@ 0x7f99196be729 (unknown)
@ 0x7f99196cff36 __assert_fail
@ 0x562077130144 Catch::CumulativeReporterBase<>::assertionEnded()
@ 0x5620770c82ef Catch::JunitReporter::assertionEnded()
@ 0x5620770ced43 Catch::ListeningReporter::assertionEnded()
@ 0x56207709cc7d Catch::RunContext::assertionEnded()
@ 0x56207709f899 Catch::RunContext::reportExpr()
@ 0x56207709f6b9 Catch::RunContext::handleExpr()
@ 0x56207707dc6e Catch::AssertionHandler::handleExpr()
@ 0x562077134220 Catch::AssertionHandler::handleExpr<>()
@ 0x562077111ce9 MyListener::testRunStarting()
@ 0x5620770ce3c6 Catch::ListeningReporter::testRunStarting()
@ 0x56207709b797 Catch::RunContext::RunContext()
@ 0x5620770a1bfc Catch::(anonymous namespace)::TestGroup::TestGroup()
@ 0x5620770a5177 Catch::Session::runInternal()
@ 0x5620770a4baf Catch::Session::run()
@ 0x562077133819 Catch::Session::run<>()
@ 0x5620770d868a main
@ 0x7f99196c00b3 __libc_start_main
@ 0x56207707b5fe _start
Aborted (core dumped)
```
Contributor guide
Assessment
This issue has not been assessed yet.