Skip to content

Commit

Permalink
GD-474: Fix test Godot Runtime Error is reported repeatedly (#475)
Browse files Browse the repository at this point in the history
# Why
see #474

# What
Do cleanup log entries after collected as reports
  • Loading branch information
MikeSchulze authored May 28, 2024
1 parent 2cfb398 commit 4f0d162
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/gdUnit4/src/monitor/GodotGdErrorMonitor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func to_reports() -> Array[GdUnitReport]:
var reports_ :Array[GdUnitReport] = []
if _report_enabled:
reports_.assign(_entries.map(_to_report))
_entries.clear()
return reports_


Expand Down
7 changes: 7 additions & 0 deletions addons/gdUnit4/test/monitor/GodotGdErrorMonitorTest.gd
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,10 @@ func test_integration_test() -> void:
assert_str(reports[1].message()).contains("Test GodotGdErrorMonitor 'push_warning' reporting")
else:
fail("Expect reporting runtime errors")

# scan second time should not report the same errors again
monitor.start()
monitor.stop()
await monitor.scan(true)
reports = monitor.to_reports()
assert_array(reports).is_empty()

0 comments on commit 4f0d162

Please sign in to comment.