Replace IgnoreMode with ExpectAnyArgsBool (no functional change).

IgnoreMode was used only for the ExpectAnyArgs plugin, and the
semantics of it were backwards:

  - IgnoreMode = CMOCK_ARG_NONE means to ignore all arguments
  - IgnoreMode = CMOCK_ARG_ALL means to verify all arguments

ExpectAnyArgsBool should make the purpose and semantics of this
field clearer.

Additionally, ExpectAnyArgs doesn't use FinalReturn for anything.
This commit is contained in:
John Lindgren
2019-09-16 13:28:14 -04:00
parent c23c01266a
commit b76d570d4a
6 changed files with 7 additions and 19 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ class CMockGeneratorPluginExpect
def mock_implementation_might_check_args(function)
return "" if (function[:args].empty?)
lines = " if (cmock_call_instance->IgnoreMode != CMOCK_ARG_NONE)\n {\n"
lines = " if (!cmock_call_instance->ExpectAnyArgsBool)\n {\n"
function[:args].each do |arg|
lines << @utils.code_verify_an_arg_expectation(function, arg)
end
+2 -10
View File
@@ -15,16 +15,8 @@ class CMockGeneratorPluginExpectAnyArgs
@priority = 3
end
def instance_structure(function)
if (function[:return][:void?]) || (@config.plugins.include? :ignore)
""
else
" #{function[:return][:type]} #{function[:name]}_FinalReturn;\n"
end
end
def instance_typedefs(function)
" CMOCK_ARG_MODE IgnoreMode;\n"
" int ExpectAnyArgsBool;\n"
end
def mock_function_declarations(function)
@@ -48,7 +40,7 @@ class CMockGeneratorPluginExpectAnyArgs
unless (function[:return][:void?])
lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n"
end
lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_NONE;\n"
lines << " cmock_call_instance->ExpectAnyArgsBool = (int)1;\n"
lines << "}\n\n"
end
end
+1 -1
View File
@@ -57,7 +57,7 @@ class CMockGeneratorUtils
lines << " cmock_call_instance->LineNumber = cmock_line;\n"
lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported)
lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception)
lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_ALL;\n" if (@expect_any)
lines << " cmock_call_instance->ExpectAnyArgsBool = (int)0;\n" if (@expect_any)
lines
end