mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-06-06 05:00:10 +08:00
Added a command line option to change the name of main.
This allows alternative entry points. This is intended for the integration of the unit test into a larger system or for it to be used with a platform/OS which requires an application entry point other than main. At the moment there is no way to change the type signature.
This commit is contained in:
@ -28,6 +28,7 @@ class UnityTestRunnerGenerator
|
|||||||
:test_prefix => "test|spec|should",
|
:test_prefix => "test|spec|should",
|
||||||
:setup_name => "setUp",
|
:setup_name => "setUp",
|
||||||
:teardown_name => "tearDown",
|
:teardown_name => "tearDown",
|
||||||
|
:main_name => "main",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -288,7 +289,10 @@ class UnityTestRunnerGenerator
|
|||||||
|
|
||||||
def create_main(output, filename, tests, used_mocks)
|
def create_main(output, filename, tests, used_mocks)
|
||||||
output.puts("\n\n//=======MAIN=====")
|
output.puts("\n\n//=======MAIN=====")
|
||||||
output.puts("int main(void)")
|
if (@options[:main_name] != "main")
|
||||||
|
output.puts("int #{@options[:main_name]}(void);")
|
||||||
|
end
|
||||||
|
output.puts("int #{@options[:main_name]}(void)")
|
||||||
output.puts("{")
|
output.puts("{")
|
||||||
output.puts(" suite_setup();") unless @options[:suite_setup].nil?
|
output.puts(" suite_setup();") unless @options[:suite_setup].nil?
|
||||||
output.puts(" UnityBegin(\"#{filename.gsub(/\\/,'\\\\')}\");")
|
output.puts(" UnityBegin(\"#{filename.gsub(/\\/,'\\\\')}\");")
|
||||||
@ -358,6 +362,7 @@ if ($0 == __FILE__)
|
|||||||
" -cexception - include cexception support",
|
" -cexception - include cexception support",
|
||||||
" --setup_name=\"\" - redefine setUp func name to something else",
|
" --setup_name=\"\" - redefine setUp func name to something else",
|
||||||
" --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",
|
||||||
" --test_prefix=\"\" - redefine test prefix from default test|spec|should",
|
" --test_prefix=\"\" - redefine test prefix from default test|spec|should",
|
||||||
" --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",
|
||||||
|
Reference in New Issue
Block a user