mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-08-05 02:37:50 +00:00
Merge pull request #148 from jlindgren90/master
Fix warnings when running "rake test" -- Thanks @jlindgren90 !
This commit is contained in:
@@ -41,7 +41,6 @@ class CMockGeneratorPluginCexception
|
||||
|
||||
def mock_interfaces(function)
|
||||
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",
|
||||
@utils.code_add_base_expectation(function[:name]),
|
||||
@utils.code_call_argument_loader(function),
|
||||
|
||||
@@ -29,14 +29,12 @@ class CMockGeneratorPluginIgnoreArg
|
||||
lines = []
|
||||
func_name = function[:name]
|
||||
function[:args].each do |arg|
|
||||
arg_name = arg[:name]
|
||||
arg_type = arg[:type]
|
||||
lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
|
||||
lines << "void #{func_name}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
|
||||
lines << "{\n"
|
||||
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"
|
||||
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"
|
||||
end
|
||||
lines
|
||||
|
||||
@@ -40,7 +40,6 @@ class CMockGeneratorPluginReturnThruPtr
|
||||
func_name = function[:name]
|
||||
function[:args].each do |arg|
|
||||
arg_name = arg[:name]
|
||||
arg_type = arg[:type]
|
||||
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 << "{\n"
|
||||
@@ -60,7 +59,6 @@ class CMockGeneratorPluginReturnThruPtr
|
||||
lines = []
|
||||
function[:args].each do |arg|
|
||||
arg_name = arg[:name]
|
||||
arg_type = arg[:type]
|
||||
if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
|
||||
lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
|
||||
lines << " {\n"
|
||||
|
||||
@@ -14,7 +14,8 @@ describe CMockConfig, "Verify CMockConfig Module" do
|
||||
it "use default settings when no parameters are specified" do
|
||||
config = CMockConfig.new
|
||||
assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path)
|
||||
assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes)
|
||||
assert_nil(CMockConfig::CMockDefaultOptions[:includes])
|
||||
assert_nil(config.includes)
|
||||
assert_equal(CMockConfig::CMockDefaultOptions[:attributes], config.attributes)
|
||||
assert_equal(CMockConfig::CMockDefaultOptions[:plugins], config.plugins)
|
||||
assert_equal(CMockConfig::CMockDefaultOptions[:treat_externs], config.treat_externs)
|
||||
@@ -35,7 +36,8 @@ describe CMockConfig, "Verify CMockConfig Module" do
|
||||
test_plugins = [:soda, :pizza]
|
||||
config = CMockConfig.new("#{File.expand_path(File.dirname(__FILE__))}/cmock_config_test.yml")
|
||||
assert_equal(CMockConfig::CMockDefaultOptions[:mock_path], config.mock_path)
|
||||
assert_equal(CMockConfig::CMockDefaultOptions[:includes], config.includes)
|
||||
assert_nil(CMockConfig::CMockDefaultOptions[:includes])
|
||||
assert_nil(config.includes)
|
||||
assert_equal(test_plugins, config.plugins)
|
||||
assert_equal(:include, config.treat_externs)
|
||||
end
|
||||
|
||||
@@ -87,7 +87,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
||||
@config.expect :weak, ""
|
||||
orig_filename = "PoutPoutFish.h"
|
||||
define_name = "MOCKPOUTPOUTFISH_H"
|
||||
mock_name = "MockPoutPoutFish"
|
||||
output = []
|
||||
expected = [
|
||||
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
||||
@@ -143,7 +142,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
||||
@config.expect :weak, ""
|
||||
orig_filename = "Pout-Pout Fish.h"
|
||||
define_name = "MOCKPOUT_POUT_FISH_H"
|
||||
mock_name = "MockPout_Pout_Fish"
|
||||
output = []
|
||||
expected = [
|
||||
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
||||
@@ -182,7 +180,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
||||
@config.expect :weak, ""
|
||||
orig_filename = "PoutPoutFish.h"
|
||||
define_name = "MOCKPOUTPOUTFISH_H"
|
||||
mock_name = "MockPoutPoutFish"
|
||||
output = []
|
||||
expected = [
|
||||
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
||||
@@ -220,7 +217,6 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
|
||||
@config.expect :weak, ""
|
||||
orig_filename = "PoutPoutFish.h"
|
||||
define_name = "MOCKPOUTPOUTFISH_H"
|
||||
mock_name = "MockPoutPoutFish"
|
||||
output = []
|
||||
expected = [
|
||||
"/* AUTOGENERATED FILE. DO NOT EDIT. */\n",
|
||||
|
||||
@@ -37,8 +37,8 @@ describe CMockGeneratorPluginArray, "Verify CMockPGeneratorluginArray Module" do
|
||||
end
|
||||
|
||||
it "have set up internal priority" do
|
||||
assert_equal(nil, @cmock_generator_plugin_array.unity_helper)
|
||||
assert_equal(8, @cmock_generator_plugin_array.priority)
|
||||
assert_nil(@cmock_generator_plugin_array.unity_helper)
|
||||
assert_equal(8, @cmock_generator_plugin_array.priority)
|
||||
end
|
||||
|
||||
it "not include any additional include files" do
|
||||
|
||||
@@ -26,8 +26,8 @@ describe CMockGeneratorPluginExpect, "Verify CMockGeneratorPluginExpect Module W
|
||||
end
|
||||
|
||||
it "have set up internal priority on init" do
|
||||
assert_equal(nil, @cmock_generator_plugin_expect.unity_helper)
|
||||
assert_equal(5, @cmock_generator_plugin_expect.priority)
|
||||
assert_nil(@cmock_generator_plugin_expect.unity_helper)
|
||||
assert_equal(5, @cmock_generator_plugin_expect.priority)
|
||||
end
|
||||
|
||||
it "not include any additional include files" do
|
||||
|
||||
@@ -26,8 +26,8 @@ describe CMockGeneratorPluginExpect, "Verify CMockGeneratorPluginExpect Module w
|
||||
end
|
||||
|
||||
it "have set up internal priority on init" do
|
||||
assert_equal(nil, @cmock_generator_plugin_expect.unity_helper)
|
||||
assert_equal(5, @cmock_generator_plugin_expect.priority)
|
||||
assert_nil(@cmock_generator_plugin_expect.unity_helper)
|
||||
assert_equal(5, @cmock_generator_plugin_expect.priority)
|
||||
end
|
||||
|
||||
it "not include any additional include files" do
|
||||
|
||||
@@ -124,11 +124,13 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh
|
||||
expected =
|
||||
" if (cmock_call_instance->ReturnThruPtr_tofu_Used)\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" +
|
||||
" }\n" +
|
||||
" }\n"
|
||||
|
||||
returned = @cmock_generator_plugin_return_thru_ptr.mock_implementation(@complex_func).join("")
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user