diff --git a/platform/tests/UNITTESTS/doubles/CMakeLists.txt b/platform/tests/UNITTESTS/doubles/CMakeLists.txt index ac94aab..3171096 100644 --- a/platform/tests/UNITTESTS/doubles/CMakeLists.txt +++ b/platform/tests/UNITTESTS/doubles/CMakeLists.txt @@ -35,4 +35,5 @@ mbed-headers-base mbed-headers-hal mbed-headers-platform + gmock_main ) diff --git a/platform/tests/UNITTESTS/doubles/mbed_assert_stub.cpp b/platform/tests/UNITTESTS/doubles/mbed_assert_stub.cpp index 875ef87..baea5f2 100644 --- a/platform/tests/UNITTESTS/doubles/mbed_assert_stub.cpp +++ b/platform/tests/UNITTESTS/doubles/mbed_assert_stub.cpp @@ -16,6 +16,7 @@ */ #include "platform/mbed_assert.h" +#include "gtest/gtest.h" #include #include @@ -27,4 +28,10 @@ if (mbed_assert_throw_errors) { throw 1; } + + /* Ensure we fail the unit test if the Mbed assertion fails. Without this, + * we might not notice the assertion failure as it wouldn't be bubbled up + * to googletest. Note that this is after the above throw, as some tests + * check that an exception is thrown (i.e. negative tests). */ + FAIL(); }