提交 c5c392b1 编写于 作者: M Mark VanderVoord

update UNITY_OUTPUT_CHAR to not return a value (because we never check it anyway).

add UNITY_OUTPUT_FLUSH to make sure we get the output we need on aborted tests and whatnot.
上级 7053ef75
......@@ -7,11 +7,18 @@
#include "unity.h"
#include <stddef.h>
//If omitted from header, declare overrideable prototypes here so they're ready for use
#ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
int UNITY_OUTPUT_CHAR(int); //If omitted from header, declare it here so it's ready for use
int UNITY_OUTPUT_CHAR(int);
#endif
#ifdef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
int UNITY_OUTPUT_FLUSH(void);
#endif
//Helpful macros for us to use here
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }
/// return prematurely if we are already in failure or ignore state
#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
......@@ -331,6 +338,7 @@ void UnityConcludeTest(void)
Unity.CurrentTestFailed = 0;
Unity.CurrentTestIgnored = 0;
UNITY_PRINT_EOL();
UNITY_OUTPUT_FLUSH();
}
//-----------------------------------------------
......@@ -1290,6 +1298,7 @@ int UnityEnd(void)
#endif
}
UNITY_PRINT_EOL();
UNITY_OUTPUT_FLUSH();
UNITY_OUTPUT_COMPLETE();
return (int)(Unity.TestFailures);
}
......
......@@ -290,11 +290,22 @@ typedef UNITY_DOUBLE_TYPE _UD;
#ifndef UNITY_OUTPUT_CHAR
//Default to using putchar, which is defined in stdio.h
#include <stdio.h>
#define UNITY_OUTPUT_CHAR(a) putchar(a)
#define UNITY_OUTPUT_CHAR(a) (void)putchar(a)
#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
extern int UNITY_OUTPUT_CHAR(int);
extern void UNITY_OUTPUT_CHAR(int);
#endif
#endif
#ifndef UNITY_OUTPUT_FLUSH
//Default to using putchar, which is defined in stdio.h
#include <stdio.h>
#define UNITY_OUTPUT_FLUSH() (void)fflush(stdout)
#else
//If defined as something else, make sure we declare it here so it's ready for use
#ifndef UNITY_OMIT_OUTPUT_FLUSH_HEADER_DECLARATION
extern void UNITY_OUTPUT_FLUSH(void);
#endif
#endif
......
......@@ -8,7 +8,7 @@
#include <stdio.h>
#include "unity.h"
int putcharSpy(int c) {return putchar(c);} // include passthrough for linking tests
void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests
#define TEST_CASE(...)
......
......@@ -2247,7 +2247,7 @@ char* getBufferPutcharSpy(void)
#endif
}
int putcharSpy(int c)
void putcharSpy(int c)
{
#ifdef USING_OUTPUT_SPY
if (putcharSpyEnabled)
......@@ -2257,7 +2257,6 @@ int putcharSpy(int c)
} else
c = putchar(c);
#endif
return c;
}
void testFailureCountIncrementsAndIsReturnedAtEnd(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册