Merge pull request from trond-snekvik/mock_suffix_support

Add support for :mock_suffix
This commit is contained in:
Mark VanderVoord
2018-06-07 06:49:28 -04:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

@ -26,6 +26,7 @@ class UnityTestRunnerGenerator
framework: :unity, framework: :unity,
test_prefix: 'test|spec|should', test_prefix: 'test|spec|should',
mock_prefix: 'Mock', mock_prefix: 'Mock',
mock_suffix: '',
setup_name: 'setUp', setup_name: 'setUp',
teardown_name: 'tearDown', teardown_name: 'tearDown',
main_name: 'main', # set to :auto to automatically generate each time main_name: 'main', # set to :auto to automatically generate each time
@ -148,7 +149,7 @@ class UnityTestRunnerGenerator
mock_headers = [] mock_headers = []
includes.each do |include_path| includes.each do |include_path|
include_file = File.basename(include_path) include_file = File.basename(include_path)
mock_headers << include_path if include_file =~ /^#{@options[:mock_prefix]}/i mock_headers << include_path if include_file =~ /^#{@options[:mock_prefix]}.*#{@options[:mock_suffix]}$/i
end end
mock_headers mock_headers
end end

@ -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.
##### `:mock_prefix` and `:mock_suffix`
Unity automatically generates calls to Init, Verify and Destroy for every file
included in the main test file that starts with the given mock prefix and ends
with the given mock suffix, file extension not included. By default, Unity
assumes a `Mock` prefix and no suffix.
##### `:plugins` ##### `:plugins`