Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GD-455: To show all failure reports at gdUnitConsole #463

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions addons/gdUnit4/src/ui/GdUnitConsole.gd
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func println_message(message: String, color: Color=_text_color, indent:=-1) -> v
output.newline()


func line_number(report: GdUnitReport) -> String:
return str(report._line_number) if report._line_number != -1 else "<n/a>"


func _on_gdunit_event(event: GdUnitEvent) -> void:
match event.type():
GdUnitEvent.INIT:
Expand All @@ -108,9 +112,9 @@ func _on_gdunit_event(event: GdUnitEvent) -> void:
GdUnitEvent.TESTSUITE_AFTER:
update_statistics(event)
if not event.reports().is_empty():
var report: GdUnitReport = event.reports().front()
println_message("\t" + event._suite_name, _engine_type_color)
println_message("line %d %s" % [report._line_number, report._message], _text_color, 2)
for report: GdUnitReport in event.reports():
println_message("line %s: %s" % [line_number(report), report._message], _text_color, 2)
if event.is_success():
print_message("[wave]PASSED[/wave]", Color.LIGHT_GREEN)
else:
Expand Down Expand Up @@ -138,9 +142,8 @@ func _on_gdunit_event(event: GdUnitEvent) -> void:
print_message("WARNING", Color.YELLOW)
println_message(" %+12s" % LocalTime.elapsed(event.elapsed_time()))

var report: GdUnitReport = null if reports.is_empty() else reports[0]
if report:
println_message("line %d %s" % [report._line_number, report._message], _text_color, 2)
for report: GdUnitReport in event.reports():
println_message("line %s: %s" % [line_number(report), report._message], _text_color, 2)


func _on_gdunit_client_connected(client_id: int) -> void:
Expand Down