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
This commit is contained in:
greg-williams
2009-07-05 18:42:39 +00:00
parent aa3277dd19
commit 18ef056d6d

View File

@ -34,6 +34,7 @@ class UnityTestRunnerGenerator
create_externs(output, tests, used_mocks) create_externs(output, tests, used_mocks)
create_mock_management(output, used_mocks) create_mock_management(output, used_mocks)
create_runtest(output, used_mocks) create_runtest(output, used_mocks)
create_reset(output, used_mocks)
create_main(output, module_name, tests) create_main(output, module_name, tests)
end end
@ -168,6 +169,16 @@ class UnityTestRunnerGenerator
output.puts("}") output.puts("}")
end 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) def create_main(output, module_name, tests)
output.puts() output.puts()