mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-25 17:31:36 +01:00
Allow suiteSetUp() and suiteTearDown() to be provided as normal C functions.
This is simpler and more flexible than embedding C code in the Ruby options
(:suite_setup and :suite_teardown). However, support for :suite_setup and
:suite_teardown is kept for backwards compatibility.
Several configurations are possible:
1. :suite_setup and :suite_teardown options provided and used.
2. :suite_setup and :suite_teardown options not provided (nil):
2a. Weak symbols not supported; suiteSetUp() and suiteTearDown() are not called.
It would be simpler to make user-provided functions mandatory in this case,
but it could break some pre-existing test suites.
2b. Weak symbols are supported and the stub implementations of suiteSetUp() and
suiteTearDown() are called if there are no user-provided functions.
2c. Weak symbols are supported but overridden by user-provided suiteSetUp() and
suiteTearDown() functions.
This commit is contained in:
11
src/unity.h
11
src/unity.h
@@ -15,9 +15,20 @@ extern "C"
|
||||
|
||||
#include "unity_internals.h"
|
||||
|
||||
/* These functions are intended to be called before and after each test. Unity
|
||||
* provides stub implementations annotated as weak symbols (if supported by the
|
||||
* compiler). */
|
||||
void setUp(void);
|
||||
void tearDown(void);
|
||||
|
||||
/* These functions are intended to be called at the beginning and end of an
|
||||
* entire test suite. suiteTearDown() is passed the number of tests that
|
||||
* failed, and its return value becomes the exit code of main(). Unity
|
||||
* provides stub implementations annotated as weak symbols (if supported by the
|
||||
* compiler). */
|
||||
void suiteSetUp(void);
|
||||
int suiteTearDown(int num_failures);
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Configuration Options
|
||||
*-------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user