Skip to content

Commit

Permalink
revert cmock_line change because it was breaking on some systems
Browse files Browse the repository at this point in the history
handle filenames with dashes and whatnot when creating header definition name
  • Loading branch information
mvandervoord committed Jul 9, 2014
1 parent a32b1e1 commit f597ba9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions lib/cmock_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def create_mock_source_file(parsed_stuff)
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"
Expand Down Expand Up @@ -136,7 +136,7 @@ def create_extern_declarations(file)
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
Expand Down Expand Up @@ -170,7 +170,7 @@ def create_mock_implementation(file, function)
# 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)
Expand Down
2 changes: 1 addition & 1 deletion targets/clang_strict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ compiler:
- '-Wpointer-arith'
- '-Wredundant-decls'
- '-Wswitch-default'
- '-Wstrict-aliasing'
- '-Wstrict-aliasing=2'
- '-Wstrict-overflow=5'
- '-Wuninitialized'
- '-Wunused'
Expand Down
6 changes: 3 additions & 3 deletions test/unit/cmock_generator_main_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def teardown
]
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" +
Expand Down Expand Up @@ -398,7 +398,7 @@ def teardown
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",
Expand Down Expand Up @@ -430,7 +430,7 @@ def teardown
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",
Expand Down

0 comments on commit f597ba9

Please sign in to comment.