mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-23 00:15:58 +01:00
Merge pull request #286 from palaviv/fix-UNITY_OUTPUT_FLUSH
Allow specifying custom header declaration (Thanks!)
This commit is contained in:
@@ -201,10 +201,12 @@
|
|||||||
* `stdout` option. You decide to route your test result output to a custom
|
* `stdout` option. You decide to route your test result output to a custom
|
||||||
* serial `RS232_putc()` function you wrote like thus:
|
* serial `RS232_putc()` function you wrote like thus:
|
||||||
*/
|
*/
|
||||||
/* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
|
/* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
|
||||||
/* #define UNITY_OUTPUT_FLUSH() RS232_flush() */
|
/* #define UNITY_OUTPUT_CHAR_HEADER_DECLARATION RS232_putc(int) */
|
||||||
/* #define UNITY_OUTPUT_START() RS232_config(115200,1,8,0) */
|
/* #define UNITY_OUTPUT_FLUSH() RS232_flush() */
|
||||||
/* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
|
/* #define UNITY_OUTPUT_FLUSH_HEADER_DECLARATION RS232_flush(void) */
|
||||||
|
/* #define UNITY_OUTPUT_START() RS232_config(115200,1,8,0) */
|
||||||
|
/* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
|
||||||
|
|
||||||
/* For some targets, Unity can make the otherwise required `setUp()` and
|
/* For some targets, Unity can make the otherwise required `setUp()` and
|
||||||
* `tearDown()` functions optional. This is a nice convenience for test writers
|
* `tearDown()` functions optional. This is a nice convenience for test writers
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ module RakefileHelpers
|
|||||||
defines = if $cfg['compiler']['defines']['items'].nil?
|
defines = if $cfg['compiler']['defines']['items'].nil?
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar'])
|
squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar'] + ['UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar\(int\)'])
|
||||||
end
|
end
|
||||||
options = squash('', $cfg['compiler']['options'])
|
options = squash('', $cfg['compiler']['options'])
|
||||||
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
|
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ endif
|
|||||||
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
|
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror
|
||||||
CFLAGS += $(DEBUG)
|
CFLAGS += $(DEBUG)
|
||||||
DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar
|
DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar
|
||||||
|
DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar\(int\)
|
||||||
SRC = ../src/unity_fixture.c \
|
SRC = ../src/unity_fixture.c \
|
||||||
../../../src/unity.c \
|
../../../src/unity.c \
|
||||||
unity_fixture_Test.c \
|
unity_fixture_Test.c \
|
||||||
|
|||||||
@@ -246,8 +246,8 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
|
|||||||
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
|
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
|
||||||
#else
|
#else
|
||||||
/* If defined as something else, make sure we declare it here so it's ready for use */
|
/* If defined as something else, make sure we declare it here so it's ready for use */
|
||||||
#ifndef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
|
#ifdef UNITY_OUTPUT_CHAR_HEADER_DECLARATION
|
||||||
extern void UNITY_OUTPUT_CHAR(int);
|
extern void UNITY_OUTPUT_CHAR_HEADER_DECLARATION;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -255,22 +255,22 @@ extern void UNITY_OUTPUT_CHAR(int);
|
|||||||
#ifdef UNITY_USE_FLUSH_STDOUT
|
#ifdef UNITY_USE_FLUSH_STDOUT
|
||||||
/* We want to use the stdout flush utility */
|
/* We want to use the stdout flush utility */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define UNITY_OUTPUT_FLUSH (void)fflush(stdout)
|
#define UNITY_OUTPUT_FLUSH() (void)fflush(stdout)
|
||||||
#else
|
#else
|
||||||
/* We've specified nothing, therefore flush should just be ignored */
|
/* We've specified nothing, therefore flush should just be ignored */
|
||||||
#define UNITY_OUTPUT_FLUSH
|
#define UNITY_OUTPUT_FLUSH()
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
/* We've defined flush as something else, so make sure we declare it here so it's ready for use */
|
/* We've defined flush as something else, so make sure we declare it here so it's ready for use */
|
||||||
#ifndef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
|
#ifdef UNITY_OUTPUT_FLUSH_HEADER_DECLARATION
|
||||||
extern void UNITY_OUTPUT_FLUSH(void);
|
extern void UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef UNITY_OUTPUT_FLUSH
|
#ifndef UNITY_OUTPUT_FLUSH
|
||||||
#define UNITY_FLUSH_CALL()
|
#define UNITY_FLUSH_CALL()
|
||||||
#else
|
#else
|
||||||
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH
|
#define UNITY_FLUSH_CALL() UNITY_OUTPUT_FLUSH()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef UNITY_PRINT_EOL
|
#ifndef UNITY_PRINT_EOL
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstri
|
|||||||
#DEBUG = -O0 -g
|
#DEBUG = -O0 -g
|
||||||
CFLAGS += $(DEBUG)
|
CFLAGS += $(DEBUG)
|
||||||
DEFINES = -D UNITY_OUTPUT_CHAR=putcharSpy
|
DEFINES = -D UNITY_OUTPUT_CHAR=putcharSpy
|
||||||
|
DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=putcharSpy\(int\)
|
||||||
DEFINES += -D UNITY_SUPPORT_64 -D UNITY_INCLUDE_DOUBLE
|
DEFINES += -D UNITY_SUPPORT_64 -D UNITY_INCLUDE_DOUBLE
|
||||||
SRC = ../src/unity.c tests/testunity.c build/testunityRunner.c
|
SRC = ../src/unity.c tests/testunity.c build/testunityRunner.c
|
||||||
INC_DIR = -I ../src
|
INC_DIR = -I ../src
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ module RakefileHelpers
|
|||||||
defines = if $cfg['compiler']['defines']['items'].nil?
|
defines = if $cfg['compiler']['defines']['items'].nil?
|
||||||
''
|
''
|
||||||
else
|
else
|
||||||
squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=putcharSpy'] + inject_defines)
|
squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=putcharSpy'] + ['UNITY_OUTPUT_CHAR_HEADER_DECLARATION=putcharSpy\(int\)'] + inject_defines)
|
||||||
end
|
end
|
||||||
options = squash('', $cfg['compiler']['options'])
|
options = squash('', $cfg['compiler']['options'])
|
||||||
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
|
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
|
||||||
|
|||||||
Reference in New Issue
Block a user