Add test result message after test finished
This commit is contained in:
parent
fb38072005
commit
9e23368b09
1 changed files with 13 additions and 1 deletions
|
@ -28,6 +28,9 @@ var stats_unknown: int = 0
|
|||
# To stop any still running test
|
||||
var crashed: bool = false
|
||||
|
||||
# To decrease allocations == to increase performance
|
||||
var temp_test_message: String = ""
|
||||
|
||||
# +++ initialization +++
|
||||
# Startup function
|
||||
func _ready() -> void:
|
||||
|
@ -252,8 +255,17 @@ func run_suite(suite: String) -> void:
|
|||
await suite_node.after_each()
|
||||
if crashed: return
|
||||
|
||||
temp_test_message = lsanitize(suite_node.test_message) if suite_node.test_message != "" else "[i]No message has been set.[/i]"
|
||||
# Merge result into result dictionary
|
||||
results.merge({ suite + ":" + test_method["name"].replace("test_", ""): { "status": suite_node.test_status, "message": lsanitize(suite_node.test_message) if suite_node.test_message != "" else "[i]No message has been set.[/i]" } })
|
||||
results.merge({ suite + ":" + test_method["name"].replace("test_", ""): { "status": suite_node.test_status, "message": temp_test_message } })
|
||||
# Print result
|
||||
match(suite_node.test_status):
|
||||
0: lresu("[color=green]Test " + suite + ":" + test_method["name"].replace("test_", "") + " has passed: " + temp_test_message + "[/color]")
|
||||
1: lresu("[color=yellow]Test " + suite + ":" + test_method["name"].replace("test_", "") + " has passed with warnings: " + temp_test_message + "[/color]")
|
||||
2: lresu("[color=red]Test " + suite + ":" + test_method["name"].replace("test_", "") + " has failed: " + temp_test_message + "[/color]")
|
||||
3: lresu("[color=gray]Test " + suite + ":" + test_method["name"].replace("test_", "") + " was skipped: " + temp_test_message + "[/color]")
|
||||
505: lresu("[color=red]Test " + suite + ":" + test_method["name"].replace("test_", "") + " returned an invalid status (did you forget to set the test status?).[/color]")
|
||||
_: lresu("[color=red]Test " + suite + ":" + test_method["name"].replace("test_", "") + " returned an invalid status.[/color]")
|
||||
|
||||
# Execute after_all()
|
||||
suite_node.lfunc = "after_all"
|
||||
|
|
Loading…
Reference in a new issue