Merge pull request #140 from jlindgren90/master

Remove dead code (unity_msg is not used since 647876644b). (Thanks @jlindgren90 )
This commit is contained in:
Mark VanderVoord
2017-09-08 13:05:31 -04:00
committed by GitHub
5 changed files with 34 additions and 48 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ class CMockGeneratorPluginExpect
function[:args].each do |arg|
lines << @utils.code_verify_an_arg_expectation(function, arg)
end
lines << "\n }\n"
lines << " }\n"
lines
end
@@ -28,7 +28,6 @@ class CMockGeneratorPluginExpectAnyArgs
end
def mock_function_declarations(function)
if (function[:return][:void?])
return "#define #{function[:name]}_ExpectAnyArgs() #{function[:name]}_CMockExpectAnyArgs(__LINE__)\n" +
"void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line);\n"
@@ -38,19 +37,6 @@ class CMockGeneratorPluginExpectAnyArgs
end
end
# def mock_implementation(function)
# lines = " if (cmock_call_instance->IgnoreMode == CMOCK_ARG_NONE)\n {\n"
# if (function[:return][:void?])
# lines << " return;\n }\n"
# else
# retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} )
# lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?])
# return_type = function[:return][:const?] ? "(const #{function[:return][:type]})" : ((function[:return][:type] =~ /cmock/) ? "(#{function[:return][:type]})" : '')
# lines << " return #{return_type}cmock_call_instance->ReturnVal;\n }\n"
# end
# lines
# end
def mock_interfaces(function)
lines = ""
if (function[:return][:void?])
+4 -5
View File
@@ -112,12 +112,11 @@ class CMockGeneratorUtils
else
(@helpers.nil? or @helpers[:unity_helper].nil?) ? ["UNITY_TEST_ASSERT_EQUAL",''] : @helpers[:unity_helper].get_helper(c_type)
end
unity_msg = "Function '#{function[:name]}' called with unexpected value for argument '#{arg_name}'."
return c_type, arg_name, expected, ignore, unity_func[0], unity_func[1], unity_msg
return c_type, arg_name, expected, ignore, unity_func[0], unity_func[1]
end
def code_verify_an_arg_expectation_with_no_arrays(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre = lookup_expect_type(function, arg)
lines = ""
lines << " if (!#{ignore})\n" if @ignore_arg
lines << " {\n"
@@ -152,7 +151,7 @@ class CMockGeneratorUtils
end
def code_verify_an_arg_expectation_with_normal_arrays(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre = lookup_expect_type(function, arg)
depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1
lines = ""
lines << " if (!#{ignore})\n" if @ignore_arg
@@ -188,7 +187,7 @@ class CMockGeneratorUtils
end
def code_verify_an_arg_expectation_with_smart_arrays(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
c_type, arg_name, expected, ignore, unity_func, pre = lookup_expect_type(function, arg)
depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1
lines = ""
lines << " if (!#{ignore})\n" if @ignore_arg
+4 -4
View File
@@ -2,12 +2,12 @@
# CMock Project - Automatic Mock Generation for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# ==========================================
class CMockPluginManager
attr_accessor :plugins
def initialize(config, utils)
@plugins = []
plugins_to_load = [:expect, config.plugins].flatten.uniq.compact
@@ -25,7 +25,7 @@ class CMockPluginManager
end
@plugins.sort! {|a,b| a.priority <=> b.priority }
end
def run(method, args=nil)
if args.nil?
return @plugins.collect{ |plugin| plugin.send(method) if plugin.respond_to?(method) }.flatten.join
@@ -33,7 +33,7 @@ class CMockPluginManager
return @plugins.collect{ |plugin| plugin.send(method, args) if plugin.respond_to?(method) }.flatten.join
end
end
def camelize(lower_case_and_underscored_word)
lower_case_and_underscored_word.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
end