summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2023-06-14 13:47:28 +0200
committerGitHub <noreply@github.com>2023-06-14 13:47:28 +0200
commit01453ab7f3e6940ecd611d63d675a484b2f55cb4 (patch)
tree0d0006dff439827621ec663fc4c7bed77d179ee0
parent824c139f6b4dda2c4e0397532ea8269385468f08 (diff)
parent72b8d397d0442e7e790b15646338e5c287b56a71 (diff)
downloadredot-engine-01453ab7f3e6940ecd611d63d675a484b2f55cb4.tar.gz
Merge pull request #78223 from akien-mga/gdscript-test-no-function
GDScript: Further restrict test error output for C++ errors
-rw-r--r--modules/gdscript/tests/gdscript_test_runner.cpp18
-rw-r--r--modules/gdscript/tests/scripts/runtime/errors/typed_array_assign_wrong_to_typed.out1
2 files changed, 9 insertions, 10 deletions
diff --git a/modules/gdscript/tests/gdscript_test_runner.cpp b/modules/gdscript/tests/gdscript_test_runner.cpp
index ce482f015c..874cbc6ee8 100644
--- a/modules/gdscript/tests/gdscript_test_runner.cpp
+++ b/modules/gdscript/tests/gdscript_test_runner.cpp
@@ -392,9 +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;
+ // Only include the function, file and line for script errors, otherwise the
+ // test outputs changes based on the platform/compiler.
+ bool include_source_info = false;
switch (p_type) {
case ERR_HANDLER_ERROR:
builder.append("ERROR");
@@ -404,7 +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;
+ include_source_info = true;
break;
case ERR_HANDLER_SHADER:
builder.append("SHADER ERROR");
@@ -414,15 +414,15 @@ void GDScriptTest::error_handler(void *p_this, const char *p_function, const cha
break;
}
- builder.append("\n>> on function: ");
- builder.append(String::utf8(p_function));
- builder.append("()\n>> ");
- if (include_path) {
+ if (include_source_info) {
+ 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).replace("\\", "/"));
builder.append("\n>> ");
builder.append(itos(p_line));
- builder.append("\n>> ");
}
+ 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 ce76228286..7b9f1066b0 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,5 +1,4 @@
GDTEST_RUNTIME_ERROR
>> ERROR
->> on function: assign()
>> Method/function failed.
not ok