summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-06-14 11:14:07 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-06-14 11:14:07 +0200
commit824c139f6b4dda2c4e0397532ea8269385468f08 (patch)
treeb94faae2d13e52c208e5eb3c8309cb1bb664982c
parent72ee877b22669ddef4d64df81aba30a313da6a11 (diff)
parentc40adf027d7f8dfa814b590787d64bd97641e430 (diff)
downloadredot-engine-824c139f6b4dda2c4e0397532ea8269385468f08.tar.gz
Merge pull request #78216 from akien-mga/gdscript-test-no-file-path
GDScript: Only include script file path in test error output
-rw-r--r--modules/gdscript/tests/gdscript_test_runner.cpp14
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out2
2 files changed, 10 insertions, 6 deletions
diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp
index b8448d16c2..ce482f015c 100644
--- a/modules/gdscript/tests/gdscript_test_runner.cpp
+++ b/modules/gdscript/tests/gdscript_test_runner.cpp
@@ -392,6 +392,9 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
StringBuilder builder;
builder.append(">> ");
+ // Only include the file path and line for script errors, otherwise the test
+ // outputs include arbitrary data which can change when we edit engine code.
+ bool include_path = false;
switch (p_type) {
case ERR_HANDLER_ERROR:
builder.append("ERROR");
@@ -401,6 +404,7 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
break;
case ERR_HANDLER_SCRIPT:
builder.append("SCRIPT ERROR");
+ include_path = true;
break;
case ERR_HANDLER_SHADER:
builder.append("SHADER ERROR");
@@ -413,10 +417,12 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
builder.append("\n>> on function: ");
builder.append(String::utf8(p_function));
builder.append("()\n>> ");
- builder.append(String::utf8(p_file).trim_prefix(self->base_dir));
- builder.append("\n>> ");
- builder.append(itos(p_line));
- builder.append("\n>> ");
+ if (include_path) {
+ builder.append(String::utf8(p_file).trim_prefix(self->base_dir).replace("\\", "/"));
+ builder.append("\n>> ");
+ builder.append(itos(p_line));
+ builder.append("\n>> ");
+ }
builder.append(String::utf8(p_error));
if (strlen(p_explanation) > 0) {
builder.append("\n>> ");
diff --git a/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out
index a300145266..ce76228286 100644
--- a/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out
+++ b/modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out
@@ -1,7 +1,5 @@
GDTEST_RUNTIME_ERROR
>> ERROR
>> on function: assign()
->> core/variant/array.cpp
->> 222
>> Method/function failed.
not ok