1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

Fix failed & ignored tests color parsing

This commit is contained in:
Alex Overchenko
2020-11-30 12:14:52 +03:00
committed by Alex Overchenko
parent 5089be60e0
commit cc36e0d82b

View File

@@ -169,6 +169,10 @@ class ParseOutput
# Test was flagged as having passed so format the output # Test was flagged as having passed so format the output
def test_passed(array) def test_passed(array)
# ':' symbol will be valid in function args now
real_method_name = array[@result_usual_idx - 1..-2].join(':')
array = array[0..@result_usual_idx - 2] + [real_method_name] + [array[-1]]
last_item = array.length - 1 last_item = array.length - 1
test_name = array[last_item - 1] test_name = array[last_item - 1]
test_suite_verify(array[@class_name_idx]) test_suite_verify(array[@class_name_idx])
@@ -181,6 +185,10 @@ class ParseOutput
# Test was flagged as having failed so format the line # Test was flagged as having failed so format the line
def test_failed(array) def test_failed(array)
# ':' symbol will be valid in function args now
real_method_name = array[@result_usual_idx - 1..-3].join(':')
array = array[0..@result_usual_idx - 3] + [real_method_name] + array[-2..-1]
last_item = array.length - 1 last_item = array.length - 1
test_name = array[last_item - 2] test_name = array[last_item - 2]
reason = array[last_item].chomp.lstrip + ' at line: ' + array[last_item - 3] reason = array[last_item].chomp.lstrip + ' at line: ' + array[last_item - 3]
@@ -204,6 +212,10 @@ class ParseOutput
# Test was flagged as being ignored so format the output # Test was flagged as being ignored so format the output
def test_ignored(array) def test_ignored(array)
# ':' symbol will be valid in function args now
real_method_name = array[@result_usual_idx - 1..-3].join(':')
array = array[0..@result_usual_idx - 3] + [real_method_name] + array[-2..-1]
last_item = array.length - 1 last_item = array.length - 1
test_name = array[last_item - 2] test_name = array[last_item - 2]
reason = array[last_item].chomp.lstrip reason = array[last_item].chomp.lstrip
@@ -307,18 +319,18 @@ class ParseOutput
test_ignored(line_array) test_ignored(line_array)
@test_ignored += 1 @test_ignored += 1
elsif line_array.size >= 4 elsif line_array.size >= 4
# ':' symbol will be valid in function args now
real_method_name = line_array[@result_usual_idx - 1..-2].join(':')
line_array = line_array[0..@result_usual_idx - 2] + [real_method_name] + [line_array[-1]]
# We will check output from color compilation # We will check output from color compilation
if line_array[@result_usual_idx].include? 'PASS' if line_array[@result_usual_idx..-1].any? {|l| l.include? 'PASS'}
test_passed(line_array) test_passed(line_array)
@test_passed += 1 @test_passed += 1
elsif line_array[@result_usual_idx].include? 'FAIL' elsif line_array[@result_usual_idx..-1].any? {|l| l.include? 'FAIL'}
test_failed(line_array) test_failed(line_array)
@test_failed += 1 @test_failed += 1
elsif line_array[@result_usual_idx].include? 'IGNORE' elsif line_array[@result_usual_idx..-2].any? {|l| l.include? 'IGNORE'}
test_ignored(line_array)
@test_ignored += 1
elsif line_array[@result_usual_idx..-1].any? {|l| l.include? 'IGNORE'}
line_array.push('No reason given')
test_ignored(line_array) test_ignored(line_array)
@test_ignored += 1 @test_ignored += 1
end end