提交 d4197dac 编写于 作者: M Mark VanderVoord

There was no reason that CMock init and destroy calls should be in the...

There was no reason that CMock init and destroy calls should be in the protected blocks. teardown is more flexible if verify is called afterwards.
上级 a77f0308
......@@ -230,21 +230,21 @@ class UnityTestRunnerGenerator
output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\")
output.puts(" Unity.NumberOfTests++; \\")
output.puts(" CMock_Init(); \\") unless (used_mocks.empty?)
output.puts(" if (TEST_PROTECT()) \\")
output.puts(" { \\")
output.puts(" CEXCEPTION_T e; \\") if cexception
output.puts(" Try { \\") if cexception
output.puts(" CMock_Init(); \\") unless (used_mocks.empty?)
output.puts(" setUp(); \\")
output.puts(" TestFunc(#{va_args2}); \\")
output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?)
output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception
output.puts(" } \\")
output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?)
output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\")
output.puts(" { \\")
output.puts(" tearDown(); \\")
output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?)
output.puts(" } \\")
output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?)
output.puts(" UnityConcludeTest(); \\")
output.puts("}\n")
end
......
......@@ -6,21 +6,21 @@
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
CMock_Init(); \
if (TEST_PROTECT()) \
{ \
CEXCEPTION_T e; \
Try { \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
UnityConcludeTest(); \
}
......
......@@ -6,18 +6,18 @@
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
CMock_Init(); \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
UnityConcludeTest(); \
}
......
......@@ -6,21 +6,21 @@
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
CMock_Init(); \
if (TEST_PROTECT()) \
{ \
CEXCEPTION_T e; \
Try { \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
UnityConcludeTest(); \
}
......
......@@ -6,18 +6,18 @@
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
CMock_Init(); \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
UnityConcludeTest(); \
}
......
......@@ -7,18 +7,18 @@
Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
CMock_Init(); \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(__VA_ARGS__); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
UnityConcludeTest(); \
}
......
......@@ -6,21 +6,21 @@
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
CMock_Init(); \
if (TEST_PROTECT()) \
{ \
CEXCEPTION_T e; \
Try { \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
UnityConcludeTest(); \
}
......
......@@ -6,18 +6,18 @@
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
CMock_Init(); \
if (TEST_PROTECT()) \
{ \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
UnityConcludeTest(); \
}
......
......@@ -6,21 +6,21 @@
Unity.CurrentTestName = #TestFunc; \
Unity.CurrentTestLineNumber = TestLineNum; \
Unity.NumberOfTests++; \
CMock_Init(); \
if (TEST_PROTECT()) \
{ \
CEXCEPTION_T e; \
Try { \
CMock_Init(); \
setUp(); \
TestFunc(); \
CMock_Verify(); \
} Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \
} \
CMock_Destroy(); \
if (TEST_PROTECT() && !TEST_IS_IGNORED) \
{ \
tearDown(); \
CMock_Verify(); \
} \
CMock_Destroy(); \
UnityConcludeTest(); \
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册