Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions auto/generate_test_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -407,43 +407,43 @@ def create_reset(output)
end

def create_run_test(output)
output.puts("/*=======Test Runner Used To Run Each Test=====*/")
output.puts("static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num)")
output.puts("{")
output.puts(" Unity.CurrentTestName = name;")
output.puts(" Unity.CurrentTestLineNumber = (UNITY_UINT) line_num;")
output.puts("#ifdef UNITY_USE_COMMAND_LINE_ARGS")
output.puts(" if (!UnityTestMatches())")
output.puts(" return;")
output.puts("#endif")
output.puts(" Unity.NumberOfTests++;")
output.puts(" UNITY_CLR_DETAILS();")
output.puts(" UNITY_EXEC_TIME_START();")
output.puts(" CMock_Init();")
output.puts(" if (TEST_PROTECT())")
output.puts(" {")
output.puts('/*=======Test Runner Used To Run Each Test=====*/')
output.puts('static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE line_num)')
output.puts('{')
output.puts(' Unity.CurrentTestName = name;')
output.puts(' Unity.CurrentTestLineNumber = (UNITY_UINT) line_num;')
output.puts('#ifdef UNITY_USE_COMMAND_LINE_ARGS')
output.puts(' if (!UnityTestMatches())')
output.puts(' return;')
output.puts('#endif')
output.puts(' Unity.NumberOfTests++;')
output.puts(' UNITY_CLR_DETAILS();')
output.puts(' UNITY_EXEC_TIME_START();')
output.puts(' CMock_Init();')
output.puts(' if (TEST_PROTECT())')
output.puts(' {')
if @options[:plugins].include?(:cexception)
output.puts(" volatile CEXCEPTION_T e;")
output.puts(" Try {")
output.puts(' volatile CEXCEPTION_T e;')
output.puts(' Try {')
output.puts(" #{@options[:setup_name]}();")
output.puts(" func();")
output.puts(" } Catch(e) {")
output.puts(" TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\");")
output.puts(" }")
output.puts(' func();')
output.puts(' } Catch(e) {')
output.puts(' TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!");')
output.puts(' }')
else
output.puts(" #{@options[:setup_name]}();")
output.puts(" func();")
output.puts(' func();')
end
output.puts(" }")
output.puts(" if (TEST_PROTECT())")
output.puts(" {")
output.puts(' }')
output.puts(' if (TEST_PROTECT())')
output.puts(' {')
output.puts(" #{@options[:teardown_name]}();")
output.puts(" CMock_Verify();")
output.puts(" }")
output.puts(" CMock_Destroy();")
output.puts(" UNITY_EXEC_TIME_STOP();")
output.puts(" UnityConcludeTest();")
output.puts("}")
output.puts(' CMock_Verify();')
output.puts(' }')
output.puts(' CMock_Destroy();')
output.puts(' UNITY_EXEC_TIME_STOP();')
output.puts(' UnityConcludeTest();')
output.puts('}')
end

def create_args_wrappers(output, tests)
Expand All @@ -465,7 +465,7 @@ def create_args_wrappers(output, tests)
def create_warning_test(output, filename, tests)
if count_tests(tests) == 0
warning_test = {
:test => "test_empty_warning",
:test => 'test_empty_warning',
:line_number => 0
}
output.puts("\n/*=======Warning Test=====*/")
Expand All @@ -475,7 +475,7 @@ def create_warning_test(output, filename, tests)
output.puts("}\n")
tests = [warning_test]
end
return tests
tests
end

def create_shuffle_tests(output)
Expand Down
8 changes: 8 additions & 0 deletions examples/unity_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,12 @@
*/
/* #define UNITY_INCLUDE_EXEC_TIME */

/* Define this macro to redefine what the UnityPrintChar() function considers
* a printable character.
*
* Example, for printing UTF-8:
* #define UNITY_IS_PRINTABLE_CHAR(c) ((128 <= (c)) && ((c) <= 255))
*/
/* #define UNITY_IS_PRINTABLE_CHAR(c) ((32 <= (c)) && ((c) <= 126)) */

#endif /* UNITY_CONFIG_H */
10 changes: 9 additions & 1 deletion src/unity.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "unity.h"

#include <stdbool.h>

#ifndef UNITY_PROGMEM
#define UNITY_PROGMEM
#endif
Expand Down Expand Up @@ -88,8 +90,14 @@ static const char UNITY_PROGMEM UnityStrDetail2Name[] = " " UNITY_DET
/* Local helper function to print characters. */
static void UnityPrintChar(const char* pch)
{
#ifdef UNITY_IS_PRINTABLE_CHAR
const int isPrintable = UNITY_IS_PRINTABLE_CHAR(*pch);
#else
const int isPrintable = ((32 <= *pch) && (*pch <= 126));
#endif

/* printable characters plus CR & LF are printed */
if ((*pch <= 126) && (*pch >= 32))
if (isPrintable)
{
UNITY_OUTPUT_CHAR(*pch);
}
Expand Down
3 changes: 2 additions & 1 deletion test/rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TEMP_DIRS = [

TEMP_DIRS.each do |dir|
directory(dir)
CLEAN.include(File.join(dir, '*.*'))
CLOBBER.include(dir)
end

Expand Down Expand Up @@ -167,7 +168,7 @@ namespace :style do

desc "Attempt to Autocorrect style"
task :auto => ['style:clean'] do
execute("rubocop ../auto ../examples ../extras --auto-correct --config .rubocop.yml")
execute("rubocop ../auto ../examples ../extras --autocorrect --config .rubocop.yml")
report "Autocorrected What We Could."
end

Expand Down
Loading