提交 4ea563e6 编写于 作者: P Peter Mendham

Added support for mocks in sub-directories.

This supports mock headers of the form:
    #include "some/dir/MockMyCode.h"
Where the mock name is actually MockMyCode.

I *think* this is the most common scenario when working with mocks
in subdirectories but if not this could be modified to support
alternate schemes.
上级 9a9d6c75
......@@ -146,8 +146,9 @@ class UnityTestRunnerGenerator
def find_mocks(includes)
mock_headers = []
includes.each do |include_file|
mock_headers << File.basename(include_file) if (include_file =~ /^mock/i)
includes.each do |include_path|
include_file = File.basename(include_path)
mock_headers << include_path if (include_file =~ /^mock/i)
end
return mock_headers
end
......@@ -192,8 +193,8 @@ class UnityTestRunnerGenerator
output.puts('')
end
def create_mock_management(output, mocks)
unless (mocks.empty?)
def create_mock_management(output, mock_headers)
unless (mock_headers.empty?)
output.puts("\n//=======Mock Management=====")
output.puts("static void CMock_Init(void)")
output.puts("{")
......@@ -202,6 +203,10 @@ class UnityTestRunnerGenerator
output.puts(" GlobalVerifyOrder = 0;")
output.puts(" GlobalOrderError = NULL;")
end
mocks = []
mock_headers.each do |mock|
mocks << File.basename(mock)
end
mocks.each do |mock|
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
output.puts(" #{mock_clean}_Init();")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册