mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
Unset argument detail before calling callback
This commit is contained in:
@@ -43,7 +43,8 @@ class CMockGeneratorPluginCallback
|
|||||||
end
|
end
|
||||||
|
|
||||||
def mock_implementation(function)
|
def mock_implementation(function)
|
||||||
" if (Mock.#{function[:name]}_CallbackFunctionPointer != NULL)\n {\n" +
|
" if (Mock.#{function[:name]}_CallbackFunctionPointer != NULL)\n {\n" \
|
||||||
|
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n" +
|
||||||
if function[:return][:void?]
|
if function[:return][:void?]
|
||||||
" #{generate_call(function)};\n }\n"
|
" #{generate_call(function)};\n }\n"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
|||||||
function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]}
|
function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]}
|
||||||
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
||||||
" {\n",
|
" {\n",
|
||||||
|
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n",
|
||||||
" Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n",
|
" Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n",
|
||||||
" }\n"
|
" }\n"
|
||||||
].join
|
].join
|
||||||
@@ -107,6 +108,7 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
|||||||
function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]}
|
function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:void]}
|
||||||
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
||||||
" {\n",
|
" {\n",
|
||||||
|
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n",
|
||||||
" Mock.Apple_CallbackFunctionPointer();\n",
|
" Mock.Apple_CallbackFunctionPointer();\n",
|
||||||
" }\n"
|
" }\n"
|
||||||
].join
|
].join
|
||||||
@@ -119,6 +121,7 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
|||||||
function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:int]}
|
function = {:name => "Apple", :args => [], :args_string => "void", :return => test_return[:int]}
|
||||||
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
||||||
" {\n",
|
" {\n",
|
||||||
|
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n",
|
||||||
" cmock_call_instance->ReturnVal = Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n",
|
" cmock_call_instance->ReturnVal = Mock.Apple_CallbackFunctionPointer(Mock.Apple_CallbackCalls++);\n",
|
||||||
" }\n"
|
" }\n"
|
||||||
].join
|
].join
|
||||||
@@ -134,6 +137,7 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
|||||||
:return=> test_return[:void]}
|
:return=> test_return[:void]}
|
||||||
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
||||||
" {\n",
|
" {\n",
|
||||||
|
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n",
|
||||||
" Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n",
|
" Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n",
|
||||||
" }\n"
|
" }\n"
|
||||||
].join
|
].join
|
||||||
@@ -149,6 +153,7 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
|||||||
:return=> test_return[:void]}
|
:return=> test_return[:void]}
|
||||||
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
||||||
" {\n",
|
" {\n",
|
||||||
|
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n",
|
||||||
" Mock.Apple_CallbackFunctionPointer(steak, flag);\n",
|
" Mock.Apple_CallbackFunctionPointer(steak, flag);\n",
|
||||||
" }\n"
|
" }\n"
|
||||||
].join
|
].join
|
||||||
@@ -165,6 +170,7 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
|||||||
:return => test_return[:int]}
|
:return => test_return[:int]}
|
||||||
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
expected = [" if (Mock.Apple_CallbackFunctionPointer != NULL)\n",
|
||||||
" {\n",
|
" {\n",
|
||||||
|
" UNITY_SET_DETAIL(CMockString_#{function[:name]});\n",
|
||||||
" cmock_call_instance->ReturnVal = Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n",
|
" cmock_call_instance->ReturnVal = Mock.Apple_CallbackFunctionPointer(steak, flag, Mock.Apple_CallbackCalls++);\n",
|
||||||
" }\n"
|
" }\n"
|
||||||
].join
|
].join
|
||||||
|
|||||||
Reference in New Issue
Block a user