@@ -11,7 +11,7 @@ def initialize(options = nil)
1111 @options = UnityTestRunnerGenerator . default_options
1212 case options
1313 when NilClass
14- @options
14+ nil # leave @options unchanged
1515 when String
1616 @options . merge! ( UnityTestRunnerGenerator . grab_config ( options ) )
1717 when Hash
@@ -72,7 +72,7 @@ def run(input_file, output_file, options = nil)
7272 source = source . force_encoding ( 'ISO-8859-1' ) . encode ( 'utf-8' , replace : nil )
7373 tests = find_tests ( source )
7474 headers = find_includes ( source )
75- testfile_includes = @options [ :use_system_files ] ? ( headers [ :local ] + headers [ :system ] ) : ( headers [ :local ] )
75+ testfile_includes = @options [ :use_system_files ] ? ( headers [ :local ] + headers [ :system ] ) : headers [ :local ]
7676 used_mocks = find_mocks ( testfile_includes )
7777 testfile_includes = ( testfile_includes - used_mocks )
7878 testfile_includes . delete_if { |inc | inc =~ /(unity|cmock)/ }
@@ -446,7 +446,7 @@ def create_shuffle_tests(output)
446446
447447 def create_main ( output , filename , tests , used_mocks )
448448 output . puts ( "\n /*=======MAIN=====*/" )
449- main_name = @options [ :main_name ] . to_sym == :auto ? "main_#{ filename . gsub ( '.c' , '' ) } " : ( @options [ :main_name ] ) . to_s
449+ main_name = @options [ :main_name ] . to_sym == :auto ? "main_#{ filename . gsub ( '.c' , '' ) } " : @options [ :main_name ] . to_s
450450 if @options [ :cmdline_args ]
451451 if main_name != 'main'
452452 output . puts ( "#{ @options [ :main_export_decl ] } int #{ main_name } (int argc, char** argv);" )
@@ -462,12 +462,12 @@ def create_main(output, filename, tests, used_mocks)
462462 output . puts ( " UnityPrint(\" #{ filename . gsub ( '.c' , '' ) . gsub ( /\\ / , '\\\\\\' ) } .\" );" )
463463 output . puts ( ' UNITY_PRINT_EOL();' )
464464 tests . each do |test |
465- if ( !@options [ :use_param_tests ] ) || test [ :args ] . nil? || test [ :args ] . empty?
465+ if !@options [ :use_param_tests ] || test [ :args ] . nil? || test [ :args ] . empty?
466466 output . puts ( " UnityPrint(\" #{ test [ :test ] } \" );" )
467467 output . puts ( ' UNITY_PRINT_EOL();' )
468468 else
469469 test [ :args ] . each do |args |
470- output . puts ( " UnityPrint(\" #{ test [ :test ] } (#{ args . gsub ( '"' , '' ) . gsub ( "\n " , '' ) } )\" );" )
470+ output . puts ( " UnityPrint(\" #{ test [ :test ] } (#{ args . gsub ( '"' , '' ) . gsub ( "\n " , '' ) } )\" );" )
471471 output . puts ( ' UNITY_PRINT_EOL();' )
472472 end
473473 end
@@ -505,7 +505,7 @@ def create_main(output, filename, tests, used_mocks)
505505 output . puts
506506 idx = 0
507507 tests . each do |test |
508- if ( !@options [ :use_param_tests ] ) || test [ :args ] . nil? || test [ :args ] . empty?
508+ if !@options [ :use_param_tests ] || test [ :args ] . nil? || test [ :args ] . empty?
509509 output . puts ( " run_test_params_arr[#{ idx } ].func = #{ test [ :test ] } ;" )
510510 output . puts ( " run_test_params_arr[#{ idx } ].name = \" #{ test [ :test ] } \" ;" )
511511 output . puts ( " run_test_params_arr[#{ idx } ].line_num = #{ test [ :line_number ] } ;" )
0 commit comments