mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-05-21 17:36:21 +08:00
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:
@ -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()
|
||||
|
Reference in New Issue
Block a user