提交 18ef056d 编写于 作者: G greg-williams

Added resetTest() method to generate_test_runnner.rb to perform mock...

Added resetTest() method to generate_test_runnner.rb to perform mock verification (optionally), tearDown() and setUp() mid-test. This allows for testing multiple passed through a given function that calls to external mocks and helps cleanup post-test state oddities. Need to figure out how to resolve this current circular reference from the test to the runner though, since the runner is what calls the test methods.

git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@36 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
上级 aa3277dd
......@@ -34,6 +34,7 @@ class UnityTestRunnerGenerator
create_externs(output, tests, used_mocks)
create_mock_management(output, used_mocks)
create_runtest(output, used_mocks)
create_reset(output, used_mocks)
create_main(output, module_name, tests)
end
......@@ -168,6 +169,16 @@ class UnityTestRunnerGenerator
output.puts("}")
end
def create_reset(output, used_mocks)
output.puts("void resetTest()")
output.puts("{")
output.puts(" CMock_Verify();") unless (used_mocks.empty?)
output.puts(" CMock_Destroy();") unless (used_mocks.empty?)
output.puts(" tearDown();")
output.puts(" CMock_Init();") unless (used_mocks.empty?)
output.puts(" setUp();")
output.puts("}")
end
def create_main(output, module_name, tests)
output.puts()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册