mirror of
https://github.com/ThrowTheSwitch/CMock
synced 2025-05-30 03:39:34 -04:00
callback's mock_destroy() is redundant.
create_mock_destroy_function() in cmock_generator.rb already clears the entire mock to 0 (using memset) before call the plugin's mock_destroy() function. So mock_destroy() in the callback plugin is doing work that was already done.
This commit is contained in:
parent
8b4deef12b
commit
fbb0828ee0
@ -81,11 +81,6 @@ class CMockGeneratorPluginCallback
|
||||
lines << " Mock.#{func_name}_CallbackFunctionPointer = Callback;\n}\n\n"
|
||||
end
|
||||
|
||||
def mock_destroy(function)
|
||||
" Mock.#{function[:name]}_CallbackFunctionPointer = NULL;\n" +
|
||||
" Mock.#{function[:name]}_CallbackCalls = 0;\n"
|
||||
end
|
||||
|
||||
def mock_verify(function)
|
||||
func_name = function[:name]
|
||||
" if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n call_instance = CMOCK_GUTS_NONE;\n"
|
||||
|
@ -255,12 +255,4 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
||||
returned = @cmock_generator_plugin_callback.mock_interfaces(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
|
||||
it "add mock destroy for functions" do
|
||||
function = {:name => "Peach", :args => [], :return => test_return[:void] }
|
||||
expected = " Mock.Peach_CallbackFunctionPointer = NULL;\n" +
|
||||
" Mock.Peach_CallbackCalls = 0;\n"
|
||||
returned = @cmock_generator_plugin_callback.mock_destroy(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user