mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-05-20 08:57:52 +08:00
- throw errors in example runner
- make unity optional in test runner generator (though that's not really too helpful at the moment) git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@73 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e
This commit is contained in:
@ -9,7 +9,7 @@ File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))
|
||||
class UnityTestRunnerGenerator
|
||||
|
||||
def initialize(options = nil)
|
||||
@options = { :includes => [] }
|
||||
@options = { :includes => [], :framework => :unity }
|
||||
case(options)
|
||||
when NilClass then @options
|
||||
when String then @options = UnityTestRunnerGenerator.grab_config(options)
|
||||
@ -19,7 +19,7 @@ class UnityTestRunnerGenerator
|
||||
end
|
||||
|
||||
def self.grab_config(config_file)
|
||||
options = { :includes => [] }
|
||||
options = { :includes => [], :framework => :unity }
|
||||
unless (config_file.nil? or config_file.empty?)
|
||||
require 'yaml'
|
||||
yaml_guts = YAML.load_file(config_file)
|
||||
@ -27,6 +27,7 @@ class UnityTestRunnerGenerator
|
||||
options[:cexception] = 1 unless (yaml_goodness[:plugins] & ['cexception', :cexception]).empty?
|
||||
options[:coverage ] = 1 if (yaml_goodness[:coverage])
|
||||
options[:order] = 1 if (yaml_goodness[:enforce_strict_ordering])
|
||||
options[:framework] = (yaml_goodness[:framework] || :unity)
|
||||
options[:includes] << (yaml_goodness[:includes])
|
||||
end
|
||||
return(options)
|
||||
@ -117,7 +118,7 @@ class UnityTestRunnerGenerator
|
||||
|
||||
def create_header(output, mocks)
|
||||
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
||||
output.puts('#include "unity.h"')
|
||||
output.puts("#include \"#{@options[:framework].to_s}.h\"")
|
||||
output.puts('#include "cmock.h"') unless (mocks.empty?)
|
||||
@options[:includes].flatten.each do |includes|
|
||||
output.puts("#include \"#{includes.gsub('.h','')}.h\"")
|
||||
|
@ -157,6 +157,7 @@ module RakefileHelpers
|
||||
results = Dir[results_glob]
|
||||
summary.set_targets(results)
|
||||
summary.run
|
||||
raise "There were failures" if (summary.failures > 0)
|
||||
end
|
||||
|
||||
def run_tests(test_files)
|
||||
@ -222,7 +223,6 @@ module RakefileHelpers
|
||||
test_results += '.testpass'
|
||||
end
|
||||
File.open(test_results, 'w') { |f| f.print output }
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user