Skip to content

Commit

Permalink
generate test runner: clean injected defines so the ifndef doesn't us…
Browse files Browse the repository at this point in the history
…e the assignment when it exists.
  • Loading branch information
mvandervoord committed Jan 19, 2024
1 parent b4f6557 commit 64939db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion auto/generate_test_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,11 @@ def create_header(output, mocks, testfile_includes = [])
output.puts('#include "cmock.h"') unless mocks.empty?
output.puts('}') if @options[:externcincludes]
if @options[:defines] && !@options[:defines].empty?
@options[:defines].each { |d| output.puts("#ifndef #{d}\n#define #{d}\n#endif /* #{d} */") }
output.puts("/* injected defines for unity settings, etc */")
@options[:defines].each do |d|
def_only = d.match(/(\w+).*/)[1]
output.puts("#ifndef #{def_only}\n#define #{d}\n#endif /* #{def_only} */")
end
end
if @options[:header_file] && !@options[:header_file].empty?
output.puts("#include \"#{File.basename(@options[:header_file])}\"")
Expand Down

0 comments on commit 64939db

Please sign in to comment.