mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-09-17 07:39:58 +00:00
Add ability to override name of the 'resetTest' function
This allows multiple groups to be compiled into the same executable by naming each function uniquely.
This commit is contained in:
@@ -27,6 +27,7 @@ class UnityTestRunnerGenerator
|
|||||||
mock_suffix: '',
|
mock_suffix: '',
|
||||||
setup_name: 'setUp',
|
setup_name: 'setUp',
|
||||||
teardown_name: 'tearDown',
|
teardown_name: 'tearDown',
|
||||||
|
test_reset_name: 'resetTest',
|
||||||
main_name: 'main', # set to :auto to automatically generate each time
|
main_name: 'main', # set to :auto to automatically generate each time
|
||||||
main_export_decl: '',
|
main_export_decl: '',
|
||||||
cmdline_args: false,
|
cmdline_args: false,
|
||||||
@@ -322,8 +323,8 @@ class UnityTestRunnerGenerator
|
|||||||
|
|
||||||
def create_reset(output, used_mocks)
|
def create_reset(output, used_mocks)
|
||||||
output.puts("\n/*=======Test Reset Option=====*/")
|
output.puts("\n/*=======Test Reset Option=====*/")
|
||||||
output.puts('void resetTest(void);')
|
output.puts("void #{@options[:test_reset_name]}(void);")
|
||||||
output.puts('void resetTest(void)')
|
output.puts("void #{@options[:test_reset_name]}(void)")
|
||||||
output.puts('{')
|
output.puts('{')
|
||||||
output.puts(' CMock_Verify();') unless used_mocks.empty?
|
output.puts(' CMock_Verify();') unless used_mocks.empty?
|
||||||
output.puts(' CMock_Destroy();') unless used_mocks.empty?
|
output.puts(' CMock_Destroy();') unless used_mocks.empty?
|
||||||
@@ -457,6 +458,7 @@ if $0 == __FILE__
|
|||||||
' --teardown_name="" - redefine tearDown func name to something else',
|
' --teardown_name="" - redefine tearDown func name to something else',
|
||||||
' --main_name="" - redefine main func name to something else',
|
' --main_name="" - redefine main func name to something else',
|
||||||
' --test_prefix="" - redefine test prefix from default test|spec|should',
|
' --test_prefix="" - redefine test prefix from default test|spec|should',
|
||||||
|
' --test_reset_name="" - redefine resetTest func name to something else',
|
||||||
' --suite_setup="" - code to execute for setup of entire suite',
|
' --suite_setup="" - code to execute for setup of entire suite',
|
||||||
' --suite_teardown="" - code to execute for teardown of entire suite',
|
' --suite_teardown="" - code to execute for teardown of entire suite',
|
||||||
' --use_param_tests=1 - enable parameterized tests (disabled by default)',
|
' --use_param_tests=1 - enable parameterized tests (disabled by default)',
|
||||||
@@ -468,4 +470,4 @@ if $0 == __FILE__
|
|||||||
ARGV[1] = ARGV[0].gsub('.c', '_Runner.c') unless ARGV[1]
|
ARGV[1] = ARGV[0].gsub('.c', '_Runner.c') unless ARGV[1]
|
||||||
|
|
||||||
UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
|
UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user