| 455 | } |
| 456 | |
| 457 | void GDScriptTest::error_handler(void *p_this, const char *p_function, const char *p_file, int p_line, const char *p_error, const char *p_explanation, bool p_editor_notify, ErrorHandlerType p_type) { |
| 458 | ErrorHandlerData *data = (ErrorHandlerData *)p_this; |
| 459 | GDScriptTest *self = data->self; |
| 460 | TestResult *result = data->result; |
| 461 | |
| 462 | result->status = GDTEST_RUNTIME_ERROR; |
| 463 | |
| 464 | String header = _error_handler_type_string(p_type); |
| 465 | |
| 466 | // Only include the file, line, and function for script errors, |
| 467 | // otherwise the test outputs changes based on the platform/compiler. |
| 468 | if (p_type == ERR_HANDLER_SCRIPT) { |
| 469 | header += vformat(" at %s:%d on %s()", |
| 470 | String::utf8(p_file).trim_prefix(self->base_dir).replace_char('\\', '/'), |
| 471 | p_line, |
| 472 | String::utf8(p_function)); |
| 473 | } |
| 474 | |
| 475 | StringBuilder error_string; |
| 476 | error_string.append(vformat(">> %s: %s\n", header, String::utf8(p_error))); |
| 477 | if (strlen(p_explanation) > 0) { |
| 478 | error_string.append(vformat(">> %s\n", String::utf8(p_explanation))); |
| 479 | } |
| 480 | |
| 481 | result->output += error_string.as_string(); |
| 482 | } |
| 483 | |
| 484 | bool GDScriptTest::check_output(const String &p_output) const { |
| 485 | Error err = OK; |
nothing calls this directly
no test coverage detected