29 lines
871 B
GDScript
29 lines
871 B
GDScript
extends Node
|
|
class_name BaseTestRunner
|
|
|
|
|
|
func _ready() -> void:
|
|
var methods := self.get_method_list()
|
|
for method in methods:
|
|
var method_name: String = method["name"]
|
|
if method_name.left(5).to_lower() != "test_":
|
|
continue
|
|
|
|
var return_dict: Dictionary = method["return"]
|
|
var return_type: int = return_dict["type"]
|
|
|
|
if return_type != 1:
|
|
print_rich("[color=yellow]Skipping Unit Test Method '%s'. Reason: Return type is not bool[/color]" % method_name)
|
|
continue
|
|
|
|
var args: Array = method["args"]
|
|
if not args.is_empty():
|
|
print_rich("[color=yellow]Skipping Unit Test Method '%s', Reason: Method requires arguments.[/color]" % method_name)
|
|
continue
|
|
|
|
var result: bool = call(method_name)
|
|
if result:
|
|
print_rich("[color=green]%s: Success![/color]" % method_name)
|
|
else:
|
|
print_rich("[color=red]%s: Failure...[/color]" % method_name)
|