class CMockGeneratorPluginCexception
¶ ↑
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]
¶ ↑
Attributes
config[R]
priority[R]
utils[R]
Public Class Methods
new(config, utils)
click to toggle source
# File vendor/cmock/lib/cmock_generator_plugin_cexception.rb, line 11 def initialize(config, utils) @config = config @utils = utils @priority = 7 raise 'Error: cexception is not supported without setjmp support' if @config.exclude_setjmp_h end
Public Instance Methods
include_files()
click to toggle source
# File vendor/cmock/lib/cmock_generator_plugin_cexception.rb, line 18 def include_files "#include \"CException.h\"\n" end
instance_typedefs(_function)
click to toggle source
# File vendor/cmock/lib/cmock_generator_plugin_cexception.rb, line 22 def instance_typedefs(_function) " CEXCEPTION_T ExceptionToThrow;\n" end
mock_function_declarations(function)
click to toggle source
# File vendor/cmock/lib/cmock_generator_plugin_cexception.rb, line 26 def mock_function_declarations(function) if function[:args_string] == 'void' "#define #{function[:name]}_ExpectAndThrow(cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n" \ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n" else "#define #{function[:name]}_ExpectAndThrow(#{function[:args_call]}, cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, #{function[:args_call]}, cmock_to_throw)\n" \ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, CEXCEPTION_T cmock_to_throw);\n" end end
mock_implementation(_function)
click to toggle source
# File vendor/cmock/lib/cmock_generator_plugin_cexception.rb, line 36 def mock_implementation(_function) " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" \ " UNITY_CLR_DETAILS();\n" \ " Throw(cmock_call_instance->ExceptionToThrow);\n }\n" end
mock_interfaces(function)
click to toggle source
# File vendor/cmock/lib/cmock_generator_plugin_cexception.rb, line 42 def mock_interfaces(function) arg_insert = function[:args_string] == 'void' ? '' : "#{function[:args_string]}, " ["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), " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n", "}\n\n"].join end