mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-01-29 11:14:27 +01:00
Refactored the os specific settings, it is now possible to convert both styles on every system (and even mixed)
This commit is contained in:
@@ -23,6 +23,7 @@ class ParseOutput
|
|||||||
@class_name = 0
|
@class_name = 0
|
||||||
@test_suite = nil
|
@test_suite = nil
|
||||||
@total_tests = false
|
@total_tests = false
|
||||||
|
@path_delim = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Set the flag to indicate if there will be an XML output file or not
|
# Set the flag to indicate if there will be an XML output file or not
|
||||||
@@ -45,11 +46,7 @@ class ParseOutput
|
|||||||
def test_suite_verify(test_suite_name)
|
def test_suite_verify(test_suite_name)
|
||||||
|
|
||||||
# Split the path name
|
# Split the path name
|
||||||
test_name = if @class_name == 1
|
test_name = test_suite_name.split(@path_delim)
|
||||||
test_suite_name.split('\\') # Windows
|
|
||||||
else
|
|
||||||
test_suite_name.split('/') # Unix based
|
|
||||||
end
|
|
||||||
|
|
||||||
# Remove the extension and extract the base_name
|
# Remove the extension and extract the base_name
|
||||||
base_name = test_name[test_name.size - 1].split('.')[0]
|
base_name = test_name[test_name.size - 1].split('.')[0]
|
||||||
@@ -59,7 +56,6 @@ class ParseOutput
|
|||||||
@test_suite = base_name
|
@test_suite = base_name
|
||||||
printf "New Test: %s\n", @test_suite
|
printf "New Test: %s\n", @test_suite
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Test was flagged as having passed so format the output
|
# Test was flagged as having passed so format the output
|
||||||
@@ -141,27 +137,24 @@ class ParseOutput
|
|||||||
@array_list.push ' </testcase>'
|
@array_list.push ' </testcase>'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Figure out what OS we are running on. For now we are assuming if it's not Windows it must
|
# Adjusts the os specific members according to the current path style
|
||||||
# be Unix based.
|
# (Windows or Unix based)
|
||||||
def detect_os
|
def set_os_specifics(line)
|
||||||
os = RUBY_PLATFORM.split('-')
|
if line.include? '\\'
|
||||||
@class_name = if os.size == 2
|
# Windows X:\Y\Z
|
||||||
if os[1] == 'mingw32'
|
@class_name = 1
|
||||||
1
|
@path_delim = '\\'
|
||||||
else
|
else
|
||||||
0
|
# Unix Based /X/Y/Z
|
||||||
end
|
@class_name = 0
|
||||||
else
|
@path_delim = '/'
|
||||||
0
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Main function used to parse the file that was captured.
|
# Main function used to parse the file that was captured.
|
||||||
def process(name)
|
def process(name)
|
||||||
@array_list = []
|
@array_list = []
|
||||||
|
|
||||||
detect_os
|
|
||||||
|
|
||||||
puts 'Parsing file: ' + name
|
puts 'Parsing file: ' + name
|
||||||
|
|
||||||
test_pass = 0
|
test_pass = 0
|
||||||
@@ -177,6 +170,7 @@ class ParseOutput
|
|||||||
# <path>/<test_file>.c:115:test_tc5100_initCanVoidPtrs:PASS
|
# <path>/<test_file>.c:115:test_tc5100_initCanVoidPtrs:PASS
|
||||||
#
|
#
|
||||||
# where path is different on Unix vs Windows devices (Windows leads with a drive letter)
|
# where path is different on Unix vs Windows devices (Windows leads with a drive letter)
|
||||||
|
set_os_specifics(line)
|
||||||
line_array = line.split(':')
|
line_array = line.split(':')
|
||||||
|
|
||||||
# If we were able to split the line then we can look to see if any of our target words
|
# If we were able to split the line then we can look to see if any of our target words
|
||||||
|
|||||||
Reference in New Issue
Block a user