Maybe I'm not using Gut the right way, but I didn't found any alternative in the docs no duplicate in the opened or closed issues. Sorry if I misunderstood the concept.
I have sometimes tests like that :
func test_example() -> void:
var object = MyClass.make_object() # can return either an object instanciated from MyClass or null
assert_is(object, MyClass, "should be MyClass")
if object is MyClass:
assert_true(object.my_class_function(), "should be true)
If I don't check that object is from MyClass before I do my second test, and object is null, then the Engine crash, because it doesn't find the function.
It would be better to check only one time, by returning the test result from the test, to write something like that :
func test_example() -> void:
var object = MyClass.make_object() # can return either an object instanciated from MyClass or null
if assert_is(object, MyClass, "should be MyClass"):
assert_true(object.my_class_function(), "should be true)
Each assert_* method would return a bool, with by default a return false at the end, and return true after each pass() call. I even may be able to make the PR myself. And it should be retrocompatible, because no assert* returns anything.
Maybe I'm not using Gut the right way, but I didn't found any alternative in the docs no duplicate in the opened or closed issues. Sorry if I misunderstood the concept.
I have sometimes tests like that :
If I don't check that object is from MyClass before I do my second test, and object is null, then the Engine crash, because it doesn't find the function.
It would be better to check only one time, by returning the test result from the test, to write something like that :
Each assert_* method would return a bool, with by default a
return falseat the end, andreturn trueafter each pass() call. I even may be able to make the PR myself. And it should be retrocompatible, because no assert* returns anything.