mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-10-02 06:57:35 +00:00
Fix Ruby warnings (mostly unused variables).
This commit is contained in:
@@ -41,7 +41,6 @@ class CMockGeneratorPluginCexception
|
|||||||
|
|
||||||
def mock_interfaces(function)
|
def mock_interfaces(function)
|
||||||
arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, "
|
arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, "
|
||||||
call_string = function[:args].map{|m| m[:name]}.join(', ')
|
|
||||||
[ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n",
|
[ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n",
|
||||||
@utils.code_add_base_expectation(function[:name]),
|
@utils.code_add_base_expectation(function[:name]),
|
||||||
@utils.code_call_argument_loader(function),
|
@utils.code_call_argument_loader(function),
|
||||||
|
|||||||
@@ -29,14 +29,12 @@ class CMockGeneratorPluginIgnoreArg
|
|||||||
lines = []
|
lines = []
|
||||||
func_name = function[:name]
|
func_name = function[:name]
|
||||||
function[:args].each do |arg|
|
function[:args].each do |arg|
|
||||||
arg_name = arg[:name]
|
lines << "void #{func_name}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
|
||||||
arg_type = arg[:type]
|
|
||||||
lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
|
|
||||||
lines << "{\n"
|
lines << "{\n"
|
||||||
lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " +
|
lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " +
|
||||||
"(CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n"
|
"(CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n"
|
||||||
lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringIgnPreExp);\n"
|
lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringIgnPreExp);\n"
|
||||||
lines << " cmock_call_instance->IgnoreArg_#{arg_name} = 1;\n"
|
lines << " cmock_call_instance->IgnoreArg_#{arg[:name]} = 1;\n"
|
||||||
lines << "}\n\n"
|
lines << "}\n\n"
|
||||||
end
|
end
|
||||||
lines
|
lines
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ class CMockGeneratorPluginReturnThruPtr
|
|||||||
func_name = function[:name]
|
func_name = function[:name]
|
||||||
function[:args].each do |arg|
|
function[:args].each do |arg|
|
||||||
arg_name = arg[:name]
|
arg_name = arg[:name]
|
||||||
arg_type = arg[:type]
|
|
||||||
if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
|
if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
|
||||||
lines << "void #{func_name}_CMockReturnMemThruPtr_#{arg_name}(UNITY_LINE_TYPE cmock_line, #{arg[:type]} #{arg_name}, int cmock_size)\n"
|
lines << "void #{func_name}_CMockReturnMemThruPtr_#{arg_name}(UNITY_LINE_TYPE cmock_line, #{arg[:type]} #{arg_name}, int cmock_size)\n"
|
||||||
lines << "{\n"
|
lines << "{\n"
|
||||||
@@ -60,7 +59,6 @@ class CMockGeneratorPluginReturnThruPtr
|
|||||||
lines = []
|
lines = []
|
||||||
function[:args].each do |arg|
|
function[:args].each do |arg|
|
||||||
arg_name = arg[:name]
|
arg_name = arg[:name]
|
||||||
arg_type = arg[:type]
|
|
||||||
if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
|
if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
|
||||||
lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
|
lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
|
||||||
lines << " {\n"
|
lines << " {\n"
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|||||||
@config.expect :weak, ""
|
@config.expect :weak, ""
|
||||||
orig_filename = "PoutPoutFish.h"
|
orig_filename = "PoutPoutFish.h"
|
||||||
define_name = "MOCKPOUTPOUTFISH_H"
|
define_name = "MOCKPOUTPOUTFISH_H"
|
||||||
mock_name = "MockPoutPoutFish"
|
|
||||||
output = []
|
output = []
|
||||||
expected = [
|
expected = [
|
||||||
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
||||||
@@ -143,7 +142,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|||||||
@config.expect :weak, ""
|
@config.expect :weak, ""
|
||||||
orig_filename = "Pout-Pout Fish.h"
|
orig_filename = "Pout-Pout Fish.h"
|
||||||
define_name = "MOCKPOUT_POUT_FISH_H"
|
define_name = "MOCKPOUT_POUT_FISH_H"
|
||||||
mock_name = "MockPout_Pout_Fish"
|
|
||||||
output = []
|
output = []
|
||||||
expected = [
|
expected = [
|
||||||
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
||||||
@@ -182,7 +180,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|||||||
@config.expect :weak, ""
|
@config.expect :weak, ""
|
||||||
orig_filename = "PoutPoutFish.h"
|
orig_filename = "PoutPoutFish.h"
|
||||||
define_name = "MOCKPOUTPOUTFISH_H"
|
define_name = "MOCKPOUTPOUTFISH_H"
|
||||||
mock_name = "MockPoutPoutFish"
|
|
||||||
output = []
|
output = []
|
||||||
expected = [
|
expected = [
|
||||||
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
||||||
@@ -220,7 +217,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
|||||||
@config.expect :weak, ""
|
@config.expect :weak, ""
|
||||||
orig_filename = "PoutPoutFish.h"
|
orig_filename = "PoutPoutFish.h"
|
||||||
define_name = "MOCKPOUTPOUTFISH_H"
|
define_name = "MOCKPOUTPOUTFISH_H"
|
||||||
mock_name = "MockPoutPoutFish"
|
|
||||||
output = []
|
output = []
|
||||||
expected = [
|
expected = [
|
||||||
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
||||||
|
|||||||
@@ -124,11 +124,13 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh
|
|||||||
expected =
|
expected =
|
||||||
" if (cmock_call_instance->ReturnThruPtr_tofu_Used)\n" +
|
" if (cmock_call_instance->ReturnThruPtr_tofu_Used)\n" +
|
||||||
" {\n" +
|
" {\n" +
|
||||||
" memcpy(tofu, cmock_call_instance->ReturnThruPtr_tofu_Val,\n" +
|
" UNITY_TEST_ASSERT_NOT_NULL(tofu, cmock_line, CMockStringPtrIsNULL);\n" +
|
||||||
|
" memcpy((void*)tofu, (void*)cmock_call_instance->ReturnThruPtr_tofu_Val,\n" +
|
||||||
" cmock_call_instance->ReturnThruPtr_tofu_Size);\n" +
|
" cmock_call_instance->ReturnThruPtr_tofu_Size);\n" +
|
||||||
" }\n" +
|
" }\n"
|
||||||
|
|
||||||
returned = @cmock_generator_plugin_return_thru_ptr.mock_implementation(@complex_func).join("")
|
returned = @cmock_generator_plugin_return_thru_ptr.mock_implementation(@complex_func).join("")
|
||||||
|
assert_equal(expected, returned)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user