| 125 | | _wi_tests_current_test = _wi_test_init_with_function(_wi_test_alloc(), wi_string_with_cstring(name), function); |
|---|
| 126 | | |
|---|
| 127 | | handler = wi_assert_handler; |
|---|
| 128 | | wi_assert_handler = _wi_tests_assert_handler; |
|---|
| 129 | | |
|---|
| 130 | | interval = wi_time_interval(); |
|---|
| 131 | | |
|---|
| 132 | | if(setjmp(_wi_tests_jmp_buf) == 0) |
|---|
| 133 | | (*_wi_tests_current_test->function)(); |
|---|
| 134 | | |
|---|
| 135 | | _wi_tests_current_test->interval = wi_time_interval() - interval; |
|---|
| 136 | | |
|---|
| 137 | | wi_assert_handler = handler; |
|---|
| 138 | | |
|---|
| 139 | | if(_wi_tests_current_test->passed) { |
|---|
| 140 | | wi_log_info(WI_STR("Test \"%@\" passed (%.3f seconds)"), |
|---|
| 141 | | _wi_tests_current_test->name, _wi_tests_current_test->interval); |
|---|
| 142 | | |
|---|
| 143 | | wi_tests_passed++; |
|---|
| | 125 | if(wi_string_has_suffix(wi_string_with_cstring(name), WI_STR("initialize"))) { |
|---|
| | 126 | (*function)(); |
|---|
| 145 | | wi_log_info(WI_STR("Test \"%@\" failed (%.3f seconds)"), |
|---|
| 146 | | _wi_tests_current_test->name, _wi_tests_current_test->interval); |
|---|
| 147 | | |
|---|
| 148 | | wi_tests_failed++; |
|---|
| | 128 | _wi_tests_current_test = _wi_test_init_with_function(_wi_test_alloc(), wi_string_with_cstring(name), function); |
|---|
| | 129 | |
|---|
| | 130 | handler = wi_assert_handler; |
|---|
| | 131 | wi_assert_handler = _wi_tests_assert_handler; |
|---|
| | 132 | |
|---|
| | 133 | interval = wi_time_interval(); |
|---|
| | 134 | |
|---|
| | 135 | if(setjmp(_wi_tests_jmp_buf) == 0) |
|---|
| | 136 | (*_wi_tests_current_test->function)(); |
|---|
| | 137 | |
|---|
| | 138 | _wi_tests_current_test->interval = wi_time_interval() - interval; |
|---|
| | 139 | |
|---|
| | 140 | wi_assert_handler = handler; |
|---|
| | 141 | |
|---|
| | 142 | if(_wi_tests_current_test->passed) { |
|---|
| | 143 | wi_log_info(WI_STR("Test \"%@\" passed (%.3f seconds)"), |
|---|
| | 144 | _wi_tests_current_test->name, _wi_tests_current_test->interval); |
|---|
| | 145 | |
|---|
| | 146 | wi_tests_passed++; |
|---|
| | 147 | } else { |
|---|
| | 148 | wi_log_info(WI_STR("Test \"%@\" failed (%.3f seconds)"), |
|---|
| | 149 | _wi_tests_current_test->name, _wi_tests_current_test->interval); |
|---|
| | 150 | |
|---|
| | 151 | wi_tests_failed++; |
|---|
| | 152 | } |
|---|
| | 153 | |
|---|
| | 154 | wi_release(_wi_tests_current_test); |
|---|