diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index 427c5136b0089a43218f7292688b85fea0745a6e..84daa42de766912298d13b01ec598c8cd0893332 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -26,6 +26,7 @@ class UnityTestRunnerGenerator framework: :unity, test_prefix: 'test|spec|should', mock_prefix: 'Mock', + mock_suffix: '', setup_name: 'setUp', teardown_name: 'tearDown', main_name: 'main', # set to :auto to automatically generate each time @@ -148,7 +149,7 @@ class UnityTestRunnerGenerator mock_headers = [] includes.each do |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 mock_headers end diff --git a/docs/UnityHelperScriptsGuide.md b/docs/UnityHelperScriptsGuide.md index 424299008bc1807d94b22a4d00b74a033b5ffbac..8b0df1b83cee87f89817c84aa2dc76751675f531 100644 --- a/docs/UnityHelperScriptsGuide.md +++ b/docs/UnityHelperScriptsGuide.md @@ -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 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`