mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-09-22 01:57:26 +00:00
Fix default path in unity test summarizer
This commit is contained in:
@@ -16,11 +16,13 @@ class UnityTestSummary
|
|||||||
|
|
||||||
attr_reader :report, :total_tests, :failures, :ignored
|
attr_reader :report, :total_tests, :failures, :ignored
|
||||||
|
|
||||||
def initialize
|
def initialize(opts = {})
|
||||||
@report = ''
|
@report = ''
|
||||||
@total_tests = 0
|
@total_tests = 0
|
||||||
@failures = 0
|
@failures = 0
|
||||||
@ignored = 0
|
@ignored = 0
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
@@ -95,7 +97,7 @@ class UnityTestSummary
|
|||||||
results = { :failures => [], :ignores => [], :successes => [] }
|
results = { :failures => [], :ignores => [], :successes => [] }
|
||||||
lines.each do |line|
|
lines.each do |line|
|
||||||
src_file,src_line,test_name,status,msg = line.split(/:/)
|
src_file,src_line,test_name,status,msg = line.split(/:/)
|
||||||
line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\")
|
line_out = ((@root && (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\")
|
||||||
case(status)
|
case(status)
|
||||||
when 'IGNORE' then results[:ignores] << line_out
|
when 'IGNORE' then results[:ignores] << line_out
|
||||||
when 'FAIL' then results[:failures] << line_out
|
when 'FAIL' then results[:failures] << line_out
|
||||||
@@ -118,17 +120,24 @@ class UnityTestSummary
|
|||||||
end
|
end
|
||||||
|
|
||||||
if $0 == __FILE__
|
if $0 == __FILE__
|
||||||
uts = UnityTestSummary.new
|
|
||||||
|
#parse out the command options
|
||||||
|
opts, args = ARGV.partition {|v| v =~ /^--\w+/}
|
||||||
|
opts.map! {|v| v[2..-1].to_sym }
|
||||||
|
|
||||||
|
#create an instance to work with
|
||||||
|
uts = UnityTestSummary.new(opts)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
#look in the specified or current directory for result files
|
#look in the specified or current directory for result files
|
||||||
ARGV[0] ||= './'
|
args[0] ||= './'
|
||||||
targets = "#{ARGV[0].gsub(/\\/, '/')}**/*.test*"
|
targets = "#{ARGV[0].gsub(/\\/, '/')}**/*.test*"
|
||||||
results = Dir[targets]
|
results = Dir[targets]
|
||||||
raise "No *.testpass or *.testfail files found in '#{targets}'" if results.empty?
|
raise "No *.testpass, *.testfail, or *.testresults files found in '#{targets}'" if results.empty?
|
||||||
uts.set_targets(results)
|
uts.set_targets(results)
|
||||||
|
|
||||||
#set the root path
|
#set the root path
|
||||||
ARGV[1] ||= File.expand_path(File.dirname(__FILE__)) + '/'
|
args[1] ||= Dir.pwd + '/'
|
||||||
uts.set_root_path(ARGV[1])
|
uts.set_root_path(ARGV[1])
|
||||||
|
|
||||||
#run the summarizer
|
#run the summarizer
|
||||||
|
|||||||
Reference in New Issue
Block a user