vendor/cmock/lib/cmock_generator.rb in ceedling-0.19.0 vs vendor/cmock/lib/cmock_generator.rb in ceedling-0.20.2
- old
+ new
@@ -12,10 +12,11 @@
@file_writer = file_writer
@utils = utils
@plugins = plugins
@config = config
@prefix = @config.mock_prefix
+ @suffix = @config.mock_suffix
@ordered = @config.enforce_strict_ordering
@framework = @config.framework.to_s
@subdir = @config.subdir
@@ -37,11 +38,11 @@
end
def create_mock(module_name, parsed_stuff)
@module_name = module_name
- @mock_name = @prefix + @module_name
+ @mock_name = @prefix + @module_name + @suffix
@clean_mock_name = TypeSanitizer.sanitize_c_identifier(@mock_name)
create_mock_subdir()
create_mock_header_file(parsed_stuff)
create_mock_source_file(parsed_stuff)
end
@@ -81,10 +82,10 @@
end
end
def create_mock_header_header(file, filename)
define_name = @clean_mock_name.upcase
- orig_filename = (@subdir ? @subdir + "/" : "") + filename[@config.mock_prefix.size..-1]
+ orig_filename = (@subdir ? @subdir + "/" : "") + @module_name + ".h"
file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
file << "#ifndef _#{define_name}_H\n"
file << "#define _#{define_name}_H\n\n"
@includes_h_pre_orig_header.each {|inc| file << "#include #{inc}\n"}
file << @config.orig_header_include_fmt.gsub(/%s/, "#{orig_filename}") + "\n"