]> Nishi Git Mirror - gwion.git/commitdiff
:wrench: test.sh summary function
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 14 Sep 2020 13:22:43 +0000 (15:22 +0200)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Mon, 14 Sep 2020 13:22:43 +0000 (15:22 +0200)
scripts/test.sh

index a7d189b75b7c2d1282ff62ba4d0e98e3d0334ce0..b3e3e48e41379ac90251fc5b07440fdbe0f7ffc9 100644 (file)
@@ -321,6 +321,21 @@ do_test() {
 done
 }
 
+summary() {
+  win=$1
+  expected=$2
+  skip=$3
+  todo=$4
+  if [ "$win" = "$expected" ] && [ "$skip" = 0 ] && [ "$todo" = 0 ]
+  then echo -e '\n\t'"${ANSI_GREEN}Everything is OK!${ANSI_RESET}"'\n'
+  else
+    echo -e '\n\t'"${ANSI_GREEN}Success: $win/$expected${ANSI_RESET}"
+    echo -e '\t'"${ANSI_RED}Failure: $failure${ANSI_RESET}"
+    echo -e '\t'"Skipped: ${ANSI_BOLD}$skip${ANSI_RESET}"
+    echo -e '\t'"todo   : ${ANSI_BOLD}$todo${ANSI_RESET}"'\n' >&2
+  fi
+}
+
 consummer() {
   local win failure skip todo expected
   win=0
@@ -365,14 +380,7 @@ consummer() {
     fi
     # ignore the rest
   done <&0
-  if [ "$win" = "$expected" ] && [ "$skip" = 0 ] && [ "$todo" = 0 ]
-  then echo -e '\n\t'"${ANSI_GREEN}Everything is OK!${ANSI_RESET}"'\n'
-  else
-    echo -e '\n\t'"${ANSI_GREEN}Success: $win/$expected${ANSI_RESET}"
-    echo -e '\t'"${ANSI_RED}Failure: $failure${ANSI_RESET}"
-    echo -e '\t'"Skipped: ${ANSI_BOLD}$skip${ANSI_RESET}"
-    echo -e '\t'"todo   : ${ANSI_BOLD}$todo${ANSI_RESET}"'\n' >&2
-  fi
+  summary "$win" "$expected" "$skip" "$todo"
   [ "$failure" -gt 0 ] && return 1
   return 0
 }