Update unity

This commit is contained in:
Max Bruckner 2017-03-01 09:23:18 +01:00
commit 899529e866
2 changed files with 36 additions and 3 deletions

View File

@ -41,13 +41,13 @@ Example:
main() main()
{ {
if (TEST_PROTECT() == 0) if (TEST_PROTECT())
{ {
MyTest(); MyTest();
} }
} }
If MyTest calls `TEST_ABORT`, program control will immediately return to `TEST_PROTECT` with a non-zero return value. If MyTest calls `TEST_ABORT`, program control will immediately return to `TEST_PROTECT` with a return value of zero.
Unity Assertion Summary Unity Assertion Summary

View File

@ -66,6 +66,17 @@ class ParseOutput
end end
end end
# Test was flagged as having passed so format the output.
# This is using the Unity fixture output and not the original Unity output.
def testPassedUnityFixture(array)
testSuite = array[0].sub("TEST(", "")
testSuite = testSuite.sub(",", "")
testName = array[1].sub(")", "")
if @xmlOut == true
@arrayList.push " <testcase classname=\"" + testSuite + "\" name=\"" + testName + "\"/>"
end
end
# Test was flagged as being ingored so format the output # Test was flagged as being ingored so format the output
def testIgnored(array) def testIgnored(array)
lastItem = array.length - 1 lastItem = array.length - 1
@ -73,6 +84,14 @@ class ParseOutput
reason = array[lastItem].chomp reason = array[lastItem].chomp
testSuiteVerify(array[@className]) testSuiteVerify(array[@className])
printf "%-40s IGNORED\n", testName printf "%-40s IGNORED\n", testName
if testName.start_with? "TEST("
array2 = testName.split(" ")
@testSuite = array2[0].sub("TEST(", "")
@testSuite = @testSuite.sub(",", "")
testName = array2[1].sub(")", "")
end
if @xmlOut == true if @xmlOut == true
@arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\">" @arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\">"
@arrayList.push " <skipped type=\"TEST IGNORED\"> " + reason + " </skipped>" @arrayList.push " <skipped type=\"TEST IGNORED\"> " + reason + " </skipped>"
@ -87,6 +106,14 @@ class ParseOutput
reason = array[lastItem].chomp + " at line: " + array[lastItem - 3] reason = array[lastItem].chomp + " at line: " + array[lastItem - 3]
testSuiteVerify(array[@className]) testSuiteVerify(array[@className])
printf "%-40s FAILED\n", testName printf "%-40s FAILED\n", testName
if testName.start_with? "TEST("
array2 = testName.split(" ")
@testSuite = array2[0].sub("TEST(", "")
@testSuite = @testSuite.sub(",", "")
testName = array2[1].sub(")", "")
end
if @xmlOut == true if @xmlOut == true
@arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\">" @arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\">"
@arrayList.push " <failure type=\"ASSERT FAILED\"> " + reason + " </failure>" @arrayList.push " <failure type=\"ASSERT FAILED\"> " + reason + " </failure>"
@ -138,7 +165,7 @@ class ParseOutput
lineSize = lineArray.size lineSize = lineArray.size
# 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
# were found. Case is important. # were found. Case is important.
if lineSize >= 4 if ((lineSize >= 4) || (line.start_with? "TEST("))
# Determine if this test passed # Determine if this test passed
if line.include? ":PASS" if line.include? ":PASS"
testPassed(lineArray) testPassed(lineArray)
@ -149,6 +176,12 @@ class ParseOutput
elsif line.include? ":IGNORE:" elsif line.include? ":IGNORE:"
testIgnored(lineArray) testIgnored(lineArray)
testIgnore += 1 testIgnore += 1
elsif line.start_with? "TEST("
if line.include? " PASS"
lineArray = line.split(" ")
testPassedUnityFixture(lineArray)
testPass += 1
end
# If none of the keywords are found there are no more tests for this suite so clear # If none of the keywords are found there are no more tests for this suite so clear
# the test flag # the test flag
else else