Skip to content

Commit

Permalink
Merge pull request #78223 from akien-mga/gdscript-test-no-function
Browse files Browse the repository at this point in the history
GDScript: Further restrict test error output for C++ errors
  • Loading branch information
akien-mga authored Jun 14, 2023
2 parents 824c139 + 72b8d39 commit 01453ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
18 changes: 9 additions & 9 deletions modules/gdscript/tests/gdscript_test_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand All @@ -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>> ");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
GDTEST_RUNTIME_ERROR
>> ERROR
>> on function: assign()
>> Method/function failed.
not ok

0 comments on commit 01453ab

Please sign in to comment.