mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-06-05 21:15:22 +00:00
Fix broken standardized failure output. Fix formatting issues
This commit is contained in:
@@ -53,7 +53,7 @@ class UnityModuleGenerator
|
||||
def initialize(options = nil)
|
||||
@options = UnityModuleGenerator.default_options
|
||||
case options
|
||||
when NilClass then @options
|
||||
when NilClass then nil # leave @options unchanged
|
||||
when String then @options.merge!(UnityModuleGenerator.grab_config(options))
|
||||
when Hash then @options.merge!(options)
|
||||
else raise 'If you specify arguments, it should be a filename or a hash of options'
|
||||
@@ -158,10 +158,10 @@ class UnityModuleGenerator
|
||||
template: cfg[:template],
|
||||
test_define: cfg[:test_define],
|
||||
boilerplate: cfg[:boilerplate],
|
||||
includes: case (cfg[:inc])
|
||||
when :src then (@options[:includes][:src] || []) | (pattern_traits[:inc].map { |f| format(f, module_name) })
|
||||
includes: case cfg[:inc]
|
||||
when :src then (@options[:includes][:src] || []) | pattern_traits[:inc].map { |f| format(f, module_name) }
|
||||
when :inc then @options[:includes][:inc] || []
|
||||
when :tst then (@options[:includes][:tst] || []) | (pattern_traits[:inc].map { |f| format("#{@options[:mock_prefix]}#{f}", module_name) })
|
||||
when :tst then (@options[:includes][:tst] || []) | pattern_traits[:inc].map { |f| format("#{@options[:mock_prefix]}#{f}", module_name) }
|
||||
end
|
||||
}
|
||||
end
|
||||
@@ -182,7 +182,7 @@ class UnityModuleGenerator
|
||||
############################
|
||||
def create_filename(part1, part2 = '')
|
||||
name = part2.empty? ? part1 : "#{part1}_#{part2}"
|
||||
case (@options[:naming])
|
||||
case @options[:naming]
|
||||
when 'bumpy' then neutralize_filename(name, start_cap: false).delete('_')
|
||||
when 'camel' then neutralize_filename(name).delete('_')
|
||||
when 'snake' then neutralize_filename(name).downcase
|
||||
|
||||
@@ -11,7 +11,7 @@ class UnityTestRunnerGenerator
|
||||
@options = UnityTestRunnerGenerator.default_options
|
||||
case options
|
||||
when NilClass
|
||||
@options
|
||||
nil # leave @options unchanged
|
||||
when String
|
||||
@options.merge!(UnityTestRunnerGenerator.grab_config(options))
|
||||
when Hash
|
||||
@@ -72,7 +72,7 @@ class UnityTestRunnerGenerator
|
||||
source = source.force_encoding('ISO-8859-1').encode('utf-8', replace: nil)
|
||||
tests = find_tests(source)
|
||||
headers = find_includes(source)
|
||||
testfile_includes = @options[:use_system_files] ? (headers[:local] + headers[:system]) : (headers[:local])
|
||||
testfile_includes = @options[:use_system_files] ? (headers[:local] + headers[:system]) : headers[:local]
|
||||
used_mocks = find_mocks(testfile_includes)
|
||||
testfile_includes = (testfile_includes - used_mocks)
|
||||
testfile_includes.delete_if { |inc| inc =~ /(unity|cmock)/ }
|
||||
@@ -446,7 +446,7 @@ class UnityTestRunnerGenerator
|
||||
|
||||
def create_main(output, filename, tests, used_mocks)
|
||||
output.puts("\n/*=======MAIN=====*/")
|
||||
main_name = @options[:main_name].to_sym == :auto ? "main_#{filename.gsub('.c', '')}" : (@options[:main_name]).to_s
|
||||
main_name = @options[:main_name].to_sym == :auto ? "main_#{filename.gsub('.c', '')}" : @options[:main_name].to_s
|
||||
if @options[:cmdline_args]
|
||||
if main_name != 'main'
|
||||
output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv);")
|
||||
@@ -462,12 +462,12 @@ class UnityTestRunnerGenerator
|
||||
output.puts(" UnityPrint(\"#{filename.gsub('.c', '').gsub(/\\/, '\\\\\\')}.\");")
|
||||
output.puts(' UNITY_PRINT_EOL();')
|
||||
tests.each do |test|
|
||||
if (!@options[:use_param_tests]) || test[:args].nil? || test[:args].empty?
|
||||
if !@options[:use_param_tests] || test[:args].nil? || test[:args].empty?
|
||||
output.puts(" UnityPrint(\" #{test[:test]}\");")
|
||||
output.puts(' UNITY_PRINT_EOL();')
|
||||
else
|
||||
test[:args].each do |args|
|
||||
output.puts(" UnityPrint(\" #{test[:test]}(#{args.gsub('"','').gsub("\n",'')})\");")
|
||||
output.puts(" UnityPrint(\" #{test[:test]}(#{args.gsub('"', '').gsub("\n", '')})\");")
|
||||
output.puts(' UNITY_PRINT_EOL();')
|
||||
end
|
||||
end
|
||||
@@ -505,7 +505,7 @@ class UnityTestRunnerGenerator
|
||||
output.puts
|
||||
idx = 0
|
||||
tests.each do |test|
|
||||
if (!@options[:use_param_tests]) || test[:args].nil? || test[:args].empty?
|
||||
if !@options[:use_param_tests] || test[:args].nil? || test[:args].empty?
|
||||
output.puts(" run_test_params_arr[#{idx}].func = #{test[:test]};")
|
||||
output.puts(" run_test_params_arr[#{idx}].name = \"#{test[:test]}\";")
|
||||
output.puts(" run_test_params_arr[#{idx}].line_num = #{test[:line_number]};")
|
||||
|
||||
@@ -113,7 +113,7 @@ end
|
||||
def link_it(exe_name, obj_list)
|
||||
linker = build_linker_fields
|
||||
cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]}"
|
||||
cmd_str += " #{(obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj}" }).join(' ')}"
|
||||
cmd_str += " #{obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj}" }.join(' ')}"
|
||||
cmd_str += " #{$cfg['linker']['bin_files']['prefix']} "
|
||||
cmd_str += $cfg['linker']['bin_files']['destination']
|
||||
cmd_str += exe_name + $cfg['linker']['bin_files']['extension']
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ const char UNITY_PROGMEM UnityStrFail[] = "FAIL";
|
||||
const char UNITY_PROGMEM UnityStrIgnore[] = "IGNORE";
|
||||
#endif
|
||||
static const char UNITY_PROGMEM UnityStrNull[] = "NULL";
|
||||
static const char UNITY_PROGMEM UnityStrSpacer[] = ". ";
|
||||
static const char UNITY_PROGMEM UnityStrSpacer[] = UNITY_FAILURE_DETAIL_SEPARATOR;
|
||||
static const char UNITY_PROGMEM UnityStrExpected[] = " Expected ";
|
||||
static const char UNITY_PROGMEM UnityStrWas[] = " Was ";
|
||||
static const char UNITY_PROGMEM UnityStrGt[] = " to be greater than ";
|
||||
|
||||
@@ -432,6 +432,10 @@ typedef UNITY_FLOAT_TYPE UNITY_FLOAT;
|
||||
#define UNITY_PRINT_EXEC_TIME() do { /* nothing*/ } while (0)
|
||||
#endif
|
||||
|
||||
#ifndef UNITY_FAILURE_DETAIL_SEPARATOR
|
||||
#define UNITY_FAILURE_DETAIL_SEPARATOR ":"
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------
|
||||
* Footprint
|
||||
*-------------------------------------------------------*/
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ namespace :style do
|
||||
end
|
||||
|
||||
task :clean do
|
||||
File.delete(".rubocop_todo.yml") if File.exists?(".rubocop_todo.yml")
|
||||
File.delete(".rubocop_todo.yml") if File.exist?(".rubocop_todo.yml")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user