mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-08-10 21:27:52 +00:00
revert cmock_line change because it was breaking on some systems
handle filenames with dashes and whatnot when creating header definition name
This commit is contained in:
@@ -63,7 +63,7 @@ class CMockGenerator
|
||||
end
|
||||
|
||||
def create_mock_header_header(file, filename)
|
||||
define_name = @clean_mock_name.gsub(/\.h/, "_h").upcase
|
||||
define_name = @clean_mock_name.gsub(/[-\/\\\.\,\s]+/,'_').upcase
|
||||
orig_filename = filename[@config.mock_prefix.size..-1]
|
||||
file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
|
||||
file << "#ifndef _#{define_name}_H\n"
|
||||
@@ -136,7 +136,7 @@ class CMockGenerator
|
||||
def create_mock_verify_function(file, functions)
|
||||
file << "void #{@clean_mock_name}_Verify(void)\n{\n"
|
||||
verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join
|
||||
file << " UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n" unless verifications.empty?
|
||||
file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" unless verifications.empty?
|
||||
file << verifications
|
||||
file << "}\n\n"
|
||||
end
|
||||
@@ -170,7 +170,7 @@ class CMockGenerator
|
||||
# Create mock function
|
||||
file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n"
|
||||
file << "{\n"
|
||||
file << " UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n"
|
||||
file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n"
|
||||
file << " CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{function[:name]}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.#{function[:name]}_CallInstance);\n"
|
||||
file << " Mock.#{function[:name]}_CallInstance = CMock_Guts_MemNext(Mock.#{function[:name]}_CallInstance);\n"
|
||||
file << @plugins.run(:mock_implementation_precheck, function)
|
||||
|
||||
@@ -25,7 +25,7 @@ compiler:
|
||||
- '-Wpointer-arith'
|
||||
- '-Wredundant-decls'
|
||||
- '-Wswitch-default'
|
||||
- '-Wstrict-aliasing'
|
||||
- '-Wstrict-aliasing=2'
|
||||
- '-Wstrict-overflow=5'
|
||||
- '-Wuninitialized'
|
||||
- '-Wunused'
|
||||
|
||||
@@ -323,7 +323,7 @@ class CMockGeneratorTest < Test::Unit::TestCase
|
||||
]
|
||||
output = []
|
||||
expected = [ "void MockPoutPoutFish_Verify(void)\n{\n",
|
||||
" UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n",
|
||||
" UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n",
|
||||
" Uno_First" +
|
||||
" Dos_First" +
|
||||
" Uno_Second" +
|
||||
@@ -398,7 +398,7 @@ class CMockGeneratorTest < Test::Unit::TestCase
|
||||
output = []
|
||||
expected = [ "static int SupaFunction(uint32 sandwiches, const char* named)\n",
|
||||
"{\n",
|
||||
" UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n",
|
||||
" UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n",
|
||||
" CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n",
|
||||
" Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n",
|
||||
" uno",
|
||||
@@ -430,7 +430,7 @@ class CMockGeneratorTest < Test::Unit::TestCase
|
||||
output = []
|
||||
expected = [ "int __stdcall SupaFunction(uint32 sandwiches, corn ...)\n",
|
||||
"{\n",
|
||||
" UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n",
|
||||
" UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n",
|
||||
" CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n",
|
||||
" Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n",
|
||||
" uno",
|
||||
|
||||
Reference in New Issue
Block a user