File tree Expand file tree Collapse file tree 3 files changed +22
-14
lines changed Expand file tree Collapse file tree 3 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -10,24 +10,31 @@ file_or_folder="$1"
1010# uses simple grep to look for failures="0" and errors="0"
1111
1212
13+ find_fail (){
14+ target=$1
15+ file=$2
16+ suite_line=$( cat " $file " | grep " $target " )
17+ if echo " $suite_line " | grep " failures=\" 0\" " ; then
18+ if echo " $suite_line " | grep " errors=\" 0\" " ; then
19+ return 0
20+ else
21+ echo " Error found in $file : $suite_line "
22+ return 1
23+ fi
24+ else
25+ echo " Failure found in $file : $suite_line "
26+ return 1
27+ fi
28+ }
1329suite_success (){
1430 file=" $1 "
1531 # look for 0 failures and errors
1632 # grep reports non zero code if anything but zero failures/errors
17- target=" <testsuites "
18- if cat " $file " | grep " $target " ; then
19- suite_line=$( cat " $file " | grep " $target " )
20- if echo " $suite_line " | grep " failures=\" 0\" " ; then
21- if echo " $suite_line " | grep " errors=\" 0\" " ; then
22- return 0
23- else
24- echo " Error found in $file : $suite_line "
25- return 1
26- fi
27- else
28- echo " Failure found in $file : $suite_line "
29- return 1
30- fi
33+ plural=" <testsuites "
34+ singular=" <testsuite "
35+ if cat " $file " | grep " $plural " ; then
36+ find_fail $plural $file
37+ return $?
3138 else
3239 echo " Skipping file without suite: $file "
3340 fi
Original file line number Diff line number Diff line change 77test/one.sh test/success_fixture.xml 0
88test/one.sh test/failure_fixture.xml 1
99test/one.sh test/error_fixture.xml 1
10+
1011test/one.sh test 1
1112test/one.sh test/success 0
1213test/one.sh test/failure 1
File renamed without changes.
You can’t perform that action at this time.
0 commit comments