mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-07-15 00:52:46 +08:00
Added support to inject "extern C" into runners when generated.
This commit is contained in:
@ -197,9 +197,11 @@ class UnityTestRunnerGenerator
|
|||||||
output.puts("\n/*=======External Functions This Runner Calls=====*/")
|
output.puts("\n/*=======External Functions This Runner Calls=====*/")
|
||||||
output.puts("extern void #{@options[:setup_name]}(void);")
|
output.puts("extern void #{@options[:setup_name]}(void);")
|
||||||
output.puts("extern void #{@options[:teardown_name]}(void);")
|
output.puts("extern void #{@options[:teardown_name]}(void);")
|
||||||
|
output.puts("\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif") if @options[:externc]
|
||||||
tests.each do |test|
|
tests.each do |test|
|
||||||
output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
|
output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
|
||||||
end
|
end
|
||||||
|
output.puts("#ifdef __cplusplus\n}\n#endif") if @options[:externc]
|
||||||
output.puts('')
|
output.puts('')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -439,6 +441,7 @@ if $0 == __FILE__
|
|||||||
' *.h - header files are added as #includes in runner',
|
' *.h - header files are added as #includes in runner',
|
||||||
' options:',
|
' options:',
|
||||||
' -cexception - include cexception support',
|
' -cexception - include cexception support',
|
||||||
|
' -externc - add extern "C" for cpp 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',
|
' --main_name="" - redefine main func name to something else',
|
||||||
|
@ -159,6 +159,12 @@ CMock (see CMock documentation). This generates extra variables required for
|
|||||||
everything to run smoothly. If you provide the same YAML to the generator as
|
everything to run smoothly. If you provide the same YAML to the generator as
|
||||||
used in CMock's configuration, you've already configured the generator properly.
|
used in CMock's configuration, you've already configured the generator properly.
|
||||||
|
|
||||||
|
|
||||||
|
##### `:externc`
|
||||||
|
|
||||||
|
This option should be defined if you are mixing C and CPP and want your test
|
||||||
|
runners to automatically include extern "C" support when they are generated.
|
||||||
|
|
||||||
##### `:mock_prefix` and `:mock_suffix`
|
##### `:mock_prefix` and `:mock_suffix`
|
||||||
|
|
||||||
Unity automatically generates calls to Init, Verify and Destroy for every file
|
Unity automatically generates calls to Init, Verify and Destroy for every file
|
||||||
|
Reference in New Issue
Block a user