- Fixed ignore plugin when called multiple times back to back with different settings

git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@173 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
mvandervoord
2010-06-26 14:40:31 +00:00
parent df253ed22e
commit 1f1c2a9ccf
4 changed files with 15 additions and 7 deletions
+6
View File
@@ -13,8 +13,10 @@ class CMockGeneratorPluginIgnore
@config = config
if (@config.ignore == :args_and_calls)
alias :mock_implementation_precheck :mock_implementation_for_ignores
alias :mock_implementation :nothing
else
alias :mock_implementation :mock_implementation_for_ignores
alias :mock_implementation_precheck :nothing
end
@utils = utils
@priority = 2
@@ -74,4 +76,8 @@ class CMockGeneratorPluginIgnore
func_name = function[:name]
" if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = NULL;\n"
end
def nothing(function)
return ""
end
end
-2
View File
@@ -260,11 +260,9 @@ module RakefileHelpers
total_failures += 1
test_results[index] =~ /test#{index+1}:(.+)/
failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:#{$1}"
print "FAIL1"
elsif (test[:verify_error]) and not (test_results[index] =~ /test#{index+1}:.*#{test[:verify_error]}/)
total_failures += 1
failure_messages << "#{test_file}:test#{index+1}:should #{test[:should]}:should have output matching '#{test[:verify_error]}'"
print "FAIL2"
end
end
end
@@ -291,7 +291,7 @@
TEST_ASSERT_EQUAL(13, function_d());
}
- :pass: TRUE
- :pass: TRUE ############
:should: 'properly ignore first function but the other will work properly'
:code: |
test()
@@ -326,7 +326,7 @@
function_e();
}
- :pass: FALSE
- :pass: FALSE ##############
:should: 'fail if we do not ignore a call once because we are counting calls'
:code: |
test()
@@ -64,7 +64,7 @@ class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase
" return;\n",
" }\n"
].join
returned = @cmock_generator_plugin_ignore.mock_implementation_precheck(function)
returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function)
assert_equal(expected, returned)
end
@@ -80,12 +80,16 @@ class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase
" return cmock_call_instance->ReturnVal;\n",
" }\n"
].join
returned = @cmock_generator_plugin_ignore.mock_implementation_precheck(function)
returned = @cmock_generator_plugin_ignore.mock_implementation_for_ignores(function)
assert_equal(expected, returned)
end
should "not add code to implementation prefix (when :args_only)" do
assert(! @cmock_generator_plugin_ignore_just_args.methods.include?(:mock_implementation_precheck))
function = {:name => "Fungus", :args_string => "void", :return => test_return[:int]}
retval = test_return[:int].merge({ :name => "cmock_call_instance->ReturnVal"})
expected = ""
returned = @cmock_generator_plugin_ignore.mock_implementation_precheck(function)
assert_equal(expected, returned)
end
should "add required code to implementation with void function (when :args_only)" do