Closed
Description
Configuration
Operating system:
Windows 10 64 bit, gcc installed via Cygwin
PlatformIO Version (platformio --version
):
PlatformIO Core, version 6.0.0rc1
Description of problem
Steps to Reproduce
Actual Results
ERROR: test case THREW exception: unknown exception
Expected Results
The exception in a readable format.
If problems with PlatformIO Build System:
The content of platformio.ini
:
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
[env:native]
platform = native
build_type = debug
debug_test = test_native
debug_build_flags = -O0 -g3 -ggdb3
test_framework = doctest
build_flags =
-O0
-Wall
-D DOCTEST_CONFIG_NO_POSIX_SIGNALS
Source file to reproduce issue:
#define DOCTEST_CONFIG_IMPLEMENT // REQUIRED: Enable custom main()
#include <doctest.h>
struct my_little_exception {};
TEST_CASE("I'll just throw something") {
SUBCASE("I hope someone is going to catch it") {
throw my_little_exception();
}
}
int main(int argc, char **argv) {
doctest::Context context;
// BEGIN:: PLATFORMIO REQUIRED OPTIONS
context.setOption("success", true); // Report successful tests
context.setOption("no-exitcode", true); // Do not return non-zero code on failed test case
// END:: PLATFORMIO REQUIRED OPTIONS
// YOUR CUSTOM DOCTEST OPTIONS
context.applyCommandLine(argc, argv);
return context.run();
}
Additional info
This is a problem especially when using Mocking frameworks like Fakeit or Google Mock as they throw errors when methods are called which have not been mocked out. Without the actual exception its time-consuming to figure out where the error occured.