mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
Merge pull request #272 from jlindgren90/master
Some minor optimizations
This commit is contained in:
@@ -86,5 +86,4 @@ class CMockGeneratorPluginCallback
|
||||
" call_instance = CMOCK_GUTS_NONE;\n" \
|
||||
" (void)call_instance;\n }\n"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -95,9 +95,10 @@ class CMockGeneratorPluginExpect
|
||||
end
|
||||
|
||||
def mock_verify(function)
|
||||
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n" +
|
||||
" UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == call_instance, cmock_line, CMockStringCalledLess);\n" +
|
||||
" UNITY_CLR_DETAILS();\n"
|
||||
" if (CMOCK_GUTS_NONE != call_instance)\n" \
|
||||
" {\n" \
|
||||
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n" \
|
||||
" UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);\n" \
|
||||
" }\n"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -174,9 +174,11 @@ describe CMockGeneratorPluginExpect, "Verify CMockGeneratorPluginExpect Module W
|
||||
|
||||
it "add mock verify lines" do
|
||||
function = {:name => "Banana" }
|
||||
expected = " UNITY_SET_DETAIL(CMockString_Banana);\n" +
|
||||
" UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == call_instance, cmock_line, CMockStringCalledLess);\n" +
|
||||
" UNITY_CLR_DETAILS();\n"
|
||||
expected = " if (CMOCK_GUTS_NONE != call_instance)\n" \
|
||||
" {\n" \
|
||||
" UNITY_SET_DETAIL(CMockString_Banana);\n" \
|
||||
" UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);\n" \
|
||||
" }\n"
|
||||
returned = @cmock_generator_plugin_expect.mock_verify(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
|
||||
@@ -190,11 +190,12 @@ describe CMockGeneratorPluginExpect, "Verify CMockGeneratorPluginExpect Module w
|
||||
|
||||
it "add mock verify lines" do
|
||||
function = {:name => "Banana" }
|
||||
expected = " UNITY_SET_DETAIL(CMockString_Banana);\n" +
|
||||
" UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == call_instance, cmock_line, CMockStringCalledLess);\n" +
|
||||
" UNITY_CLR_DETAILS();\n"
|
||||
expected = " if (CMOCK_GUTS_NONE != call_instance)\n" \
|
||||
" {\n" \
|
||||
" UNITY_SET_DETAIL(CMockString_Banana);\n" \
|
||||
" UNITY_TEST_FAIL(cmock_line, CMockStringCalledLess);\n" \
|
||||
" }\n"
|
||||
returned = @cmock_generator_plugin_expect.mock_verify(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user