From 13e40e84eec7fe513b7b5eab9c7f36d315286588 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 3 Dec 2021 11:43:50 +0100 Subject: [PATCH] extras/fixture: add missing C++ include guards This fixes linking errors when test cases based on Unity fixture are defined in a .cpp file. unity_internals.h doesn't have C++ guards, and is included from unity.h from within C++ header guard block. Same approach is taken in this commit --- extras/fixture/src/unity_fixture.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/extras/fixture/src/unity_fixture.h b/extras/fixture/src/unity_fixture.h index 4cc403e..6575066 100644 --- a/extras/fixture/src/unity_fixture.h +++ b/extras/fixture/src/unity_fixture.h @@ -9,13 +9,20 @@ #define UNITY_FIXTURE_H_ #include "unity.h" -#include "unity_internals.h" #include "unity_fixture_internals.h" #ifndef UNITY_FIXTURE_NO_EXTRAS #include "unity_memory.h" #endif +#ifdef __cplusplus +extern "C" +{ +#endif + +#include "unity_internals.h" + + int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)); @@ -80,4 +87,8 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void)); #define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual)) #endif +#ifdef __cplusplus +} +#endif + #endif /* UNITY_FIXTURE_H_ */