11#! /bin/bash
22
3- _START_TIME=$( date +%s%N) ;
43_SUCCESSFUL_TEST_COUNT=0
54
65function console_results::render_result() {
@@ -9,7 +8,7 @@ function console_results::render_result() {
98 printf " %s%s%s\n" " ${_COLOR_RETURN_ERROR} " " Duplicate test functions found" " ${_COLOR_DEFAULT} "
109 printf " File with duplicate functions: %s\n" " $( state::get_file_with_duplicated_function_names) "
1110 printf " Duplicate functions: %s\n" " $( state::get_duplicated_function_names) "
12- exit 1
11+ return 1
1312 fi
1413
1514 echo " "
@@ -67,47 +66,45 @@ function console_results::render_result() {
6766 if [[ " $( state::get_tests_failed) " -gt 0 ]]; then
6867 printf " \n%s%s%s\n" " $_COLOR_RETURN_ERROR " " Some tests failed " " $_COLOR_DEFAULT "
6968 console_results::print_execution_time
70- exit 1
69+ return 1
7170 fi
7271
7372 if [[ " $( state::get_tests_incomplete) " -gt 0 ]]; then
7473 printf " \n%s%s%s\n" " $_COLOR_RETURN_INCOMPLETE " " Some tests incomplete " " $_COLOR_DEFAULT "
7574 console_results::print_execution_time
76- exit 0
75+ return 0
7776 fi
7877
7978 if [[ " $( state::get_tests_skipped) " -gt 0 ]]; then
8079 printf " \n%s%s%s\n" " $_COLOR_RETURN_SKIPPED " " Some tests skipped " " $_COLOR_DEFAULT "
8180 console_results::print_execution_time
82- exit 0
81+ return 0
8382 fi
8483
8584 if [[ " $( state::get_tests_snapshot) " -gt 0 ]]; then
8685 printf " \n%s%s%s\n" " $_COLOR_RETURN_SNAPSHOT " " Some snapshots created " " $_COLOR_DEFAULT "
8786 console_results::print_execution_time
88- exit 0
87+ return 0
8988 fi
9089
9190 if [[ $total_tests -eq 0 ]]; then
9291 printf " \n%s%s%s\n" " $_COLOR_RETURN_ERROR " " No tests found " " $_COLOR_DEFAULT "
9392 console_results::print_execution_time
94- exit 1
93+ return 1
9594 fi
9695
9796 printf " \n%s%s%s\n" " $_COLOR_RETURN_SUCCESS " " All tests passed " " $_COLOR_DEFAULT "
9897 console_results::print_execution_time
99- exit 0
98+ return 0
10099}
101100
102101function console_results::print_execution_time() {
103102 if [[ $SHOW_EXECUTION_TIME == false ]]; then
104103 return
105104 fi
106105
107- if [[ " $_OS " != " OSX" ]]; then
108- _EXECUTION_TIME=$(( ($(date +% s% N) - "$_START_TIME ") / 1000000 ))
109- printf " ${_COLOR_BOLD} %s${_COLOR_DEFAULT} \n" " Time taken: ${_EXECUTION_TIME} ms"
110- fi
106+ _EXECUTION_TIME=$( clock::runtime_in_milliseconds)
107+ printf " ${_COLOR_BOLD} %s${_COLOR_DEFAULT} \n" " Time taken: ${_EXECUTION_TIME} ms"
111108}
112109
113110function console_results::print_successful_test() {
0 commit comments