1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00

GDScript: Further restrict test error output for C++ errors

MSVC and GCC/Clang also have different function names...
This commit is contained in:
Rémi Verschelde
2023-06-14 13:28:04 +02:00
parent 824c139f6b
commit 72b8d397d0
2 changed files with 9 additions and 10 deletions

View File

@@ -392,9 +392,9 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
StringBuilder builder; StringBuilder builder;
builder.append(">> "); builder.append(">> ");
// Only include the file path and line for script errors, otherwise the test // Only include the function, file and line for script errors, otherwise the
// outputs include arbitrary data which can change when we edit engine code. // test outputs changes based on the platform/compiler.
bool include_path = false; bool include_source_info = false;
switch (p_type) { switch (p_type) {
case ERR_HANDLER_ERROR: case ERR_HANDLER_ERROR:
builder.append("ERROR"); builder.append("ERROR");
@@ -404,7 +404,7 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
break; break;
case ERR_HANDLER_SCRIPT: case ERR_HANDLER_SCRIPT:
builder.append("SCRIPT ERROR"); builder.append("SCRIPT ERROR");
include_path = true; include_source_info = true;
break; break;
case ERR_HANDLER_SHADER: case ERR_HANDLER_SHADER:
builder.append("SHADER ERROR"); builder.append("SHADER ERROR");
@@ -414,15 +414,15 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
break; break;
} }
if (include_source_info) {
builder.append("\n>> on function: "); builder.append("\n>> on function: ");
builder.append(String::utf8(p_function)); builder.append(String::utf8(p_function));
builder.append("()\n>> "); builder.append("()\n>> ");
if (include_path) {
builder.append(String::utf8(p_file).trim_prefix(self->base_dir).replace("\\", "/")); builder.append(String::utf8(p_file).trim_prefix(self->base_dir).replace("\\", "/"));
builder.append("\n>> "); builder.append("\n>> ");
builder.append(itos(p_line)); builder.append(itos(p_line));
builder.append("\n>> ");
} }
builder.append("\n>> ");
builder.append(String::utf8(p_error)); builder.append(String::utf8(p_error));
if (strlen(p_explanation) > 0) { if (strlen(p_explanation) > 0) {
builder.append("\n>> "); builder.append("\n>> ");

View File

@@ -1,5 +1,4 @@
GDTEST_RUNTIME_ERROR GDTEST_RUNTIME_ERROR
>> ERROR >> ERROR
>> on function: assign()
>> Method/function failed. >> Method/function failed.
not ok not ok