module
Lapis::Test
Extended Modules
Defined in:
libgodot/testing.crClass Method Summary
Instance Method Summary
-
#add_child_autofree(parent : Godot::Node, child : T) : T forall T
Adds a child node to the parent and registers it for automatic queue_free
-
#add_child_autofree(child : T) : T forall T
Overload when called in test_suite where single argument node is registered
-
#assert_alive(object : Godot::Object, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that the Godot object is alive in ObjectDB and has not been destroyed
-
#assert_approx_eq(actual : Float32 | Float64, expected : Float32 | Float64, epsilon : Float64 = 0.001, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that two floating-point values are approximately equal within a tolerance epsilon
-
#assert_between(actual : Number, min : Number, max : Number, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a numeric value falls within the inclusive range [min, max]
-
#assert_connected(emitter : Godot::Object, signal_name : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that emitter's signal has active connections
-
#assert_disposed(object : Godot::Object, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that the Godot object has been destroyed/freed
-
#assert_emits(emitter : Godot::Object, signal_name : String, timeout_sec : Float64 = 2.0, file : String = __FILE__, line : Int32 = __LINE__, &) : Array(Variant)
Executes the provided block and asserts that the specified signal is emitted within
timeout_sec. -
#assert_empty(collection, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a collection is empty
-
#assert_eq(actual, expected, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that two values are equal using Crystal's == operator
-
#assert_false(cond : Bool, msg : String = "Expected false, got true", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that the boolean condition evaluates to false
-
#assert_file_does_not_exist(path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a file does not exist on disk
-
#assert_file_empty(path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a file is empty (0 bytes)
-
#assert_file_exists(path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a file exists on disk
-
#assert_file_not_empty(path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a file is not empty (> 0 bytes)
-
#assert_freed(object : Godot::Object, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that an object has been freed / disposed (alias to assert_disposed)
-
#assert_gt(actual : Comparable, expected : Comparable, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that actual > expected
-
#assert_gte(actual : Comparable, expected : Comparable, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that actual >= expected
-
#assert_has_method(obj : Godot::Object, method_name : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a Godot object has a defined method
-
#assert_has_node(parent : Godot::Node, path : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a Godot node has a child node at path
-
#assert_has_signal(emitter : Godot::Object, signal_name : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a Godot object has declared a signal
-
#assert_in_delta(actual : Number, expected : Number, delta : Number, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a numeric value is within delta of the expected value
-
#assert_includes(collection, item, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a collection contains the specified item
-
#assert_invalid_id(instance_id : UInt64 | Int64, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that an instance ID is no longer valid in Godot's ObjectDB
-
#assert_is_a(obj, klass : T.class, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__) forall T
Asserts that object is an instance of the given class
-
#assert_lt(actual : Comparable, expected : Comparable, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that actual < expected
-
#assert_lte(actual : Comparable, expected : Comparable, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that actual <= expected
-
#assert_ne(actual, expected, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that two values are not equal using Crystal's != operator
-
#assert_nil(val, msg : String = "Expected nil value", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a value is nil
-
#assert_no_emit(emitter : Godot::Object, signal_name : String, duration_sec : Float64 = 0.5, file : String = __FILE__, line : Int32 = __LINE__, &) : Void
Executes the provided block and verifies that the specified signal is NOT emitted during
duration_sec. -
#assert_no_leak(max_delta_objects : Int32 = 0, name : String = "Operation", file : String = __FILE__, line : Int32 = __LINE__, &)
Executes the provided block and asserts that Godot ObjectDB object and node counts return to baseline after Boehm GC collection and frame draining.
-
#assert_no_new_orphans(msg : String = "", file : String = __FILE__, line : Int32 = __LINE__, &)
Asserts that the block does not introduce any orphan nodes (Performance::ObjectOrphanNodeCount)
-
#assert_not_between(actual : Number, min : Number, max : Number, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a numeric value does NOT fall within the inclusive range [min, max]
-
#assert_not_connected(emitter : Godot::Object, signal_name : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that emitter's signal has NO active connections
-
#assert_not_empty(collection, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a collection is not empty
-
#assert_not_freed(object : Godot::Object, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that an object has NOT been freed / is alive (alias to assert_alive)
-
#assert_not_nil(val, msg : String = "Expected non-nil value", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a value is non-nil
-
#assert_not_same(actual : Reference, expected : Reference, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that actual and expected do not reference the exact same object
-
#assert_raises(klass : T.class, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__, &) forall T
Asserts that evaluating the block raises an exception of the expected class T
-
#assert_refcount(refcounted : Godot::RefCounted, expected : Int32, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a RefCounted instance has the expected reference count
-
#assert_same(actual : Reference, expected : Reference, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that actual and expected reference the exact same object
-
#assert_signal_count(spy : SignalSpy, count : Int32, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a SignalSpy recorded exactly the expected number of emissions (backwards compatibility)
-
#assert_signal_emit_count(spy : SignalSpy, count : Int32, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a SignalSpy recorded exactly count emissions
-
#assert_signal_emitted(spy : SignalSpy, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a SignalSpy recorded at least one emission
-
#assert_signal_not_emitted(spy : SignalSpy, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that a SignalSpy did NOT record any emissions
-
#assert_string_contains(str : String, substr : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that string contains the specified substring
-
#assert_string_ends_with(str : String, suffix : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that string ends with the specified suffix
-
#assert_string_starts_with(str : String, prefix : String, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that string starts with the specified prefix
-
#assert_true(cond : Bool, msg : String = "Expected true, got false", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that the boolean condition evaluates to true
-
#assert_valid_id(instance_id : UInt64 | Int64, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that an instance ID is currently valid in Godot's ObjectDB
-
#assert_vector_approx(actual : Godot::Vector2, expected : Godot::Vector2, epsilon : Float64 = 0.001, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that two Vector2 values are approximately equal within epsilon
-
#assert_vector_approx(actual : Godot::Vector3, expected : Godot::Vector3, epsilon : Float64 = 0.001, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that two Vector3 values are approximately equal within epsilon
-
#assert_vector_approx(actual : Godot::Color, expected : Godot::Color, epsilon : Float64 = 0.001, msg : String = "", file : String = __FILE__, line : Int32 = __LINE__)
Asserts that two Color values are approximately equal within epsilon
-
#autofree(obj : T) : T forall T
Registers an object to be safely disposed at the end of the test
-
#autofree_all : Void
Alias for cleanup_autofree
-
#autoqfree(node : T) : T forall T
Registers a node to be queue_freed at the end of the test
-
#await_signal(emitter : Godot::Object, signal_name : String, timeout_sec : Float64 = 2.0, file : String = __FILE__, line : Int32 = __LINE__) : Array(Variant)
Cooperatively awaits a signal on the target emitter.
-
#cleanup_autofree : Void
Cleans up all auto-freed objects and nodes created during a test
-
#cleanup_tracked_nodes : Void
Cleans up all tracked nodes created during a test
- #input_sender : InputSender
-
#pending(reason : String = "Test pending implementation") : Nil
Marks the currently running test as pending implementation
-
#simulate(node : Godot::Node, frames : Int32 = 1, delta : Float64 = 0.016666666666666666, physics : Bool = false) : Void
Deterministically simulates frames of processing on a node and its recursive children
-
#skip_frames(count : Int32 = 1) : Void
Cooperatively yields until the specified number of process (render/idle) frames have elapsed
-
#skip_if(condition : Bool, reason : String = "Test skipped") : Nil
Conditionally skips the currently running test if condition evaluates to true
-
#skip_physics_frames(count : Int32 = 1) : Void
Cooperatively yields until the specified number of fixed physics frames have elapsed
-
#suppress_errors(&)
Temporarily suppresses engine error printing to stdout/stderr while evaluating the block
-
#track_node(node : Godot::Node) : Godot::Node
Registers a node to be automatically destroyed and cleaned up in after_each
-
#with_node(klass : T.class, parent : Godot::Node | Nil = nil, &block : T -> Void) forall T
Safely creates a node of type T, yields it to the block, and guarantees destruction
-
#with_timeout(timeout_sec : Float64 = 5.0, operation_name : String = "Operation", file : String = __FILE__, line : Int32 = __LINE__, &)
Executes a block with an active timeout watchdog, raising
TimeoutErrorif it fails to finish in time
Class Method Detail
Instance Method Detail
Adds a child node to the parent and registers it for automatic queue_free
Overload when called in test_suite where single argument node is registered
Asserts that the Godot object is alive in ObjectDB and has not been destroyed
Asserts that two floating-point values are approximately equal within a tolerance epsilon
Asserts that a numeric value falls within the inclusive range [min, max]
Asserts that emitter's signal has active connections
Asserts that the Godot object has been destroyed/freed
Executes the provided block and asserts that the specified signal is emitted within timeout_sec.
Returns the emitted arguments. Raises AssertionError if the signal fails to emit.
Asserts that a collection is empty
Asserts that two values are equal using Crystal's == operator
Asserts that the boolean condition evaluates to false
Asserts that a file does not exist on disk
Asserts that a file is empty (0 bytes)
Asserts that a file exists on disk
Asserts that a file is not empty (> 0 bytes)
Asserts that an object has been freed / disposed (alias to assert_disposed)
Asserts that actual > expected
Asserts that actual >= expected
Asserts that a Godot object has a defined method
Asserts that a Godot node has a child node at path
Asserts that a Godot object has declared a signal
Asserts that a numeric value is within delta of the expected value
Asserts that a collection contains the specified item
Asserts that an instance ID is no longer valid in Godot's ObjectDB
Asserts that object is an instance of the given class
Asserts that actual < expected
Asserts that actual <= expected
Asserts that two values are not equal using Crystal's != operator
Asserts that a value is nil
Executes the provided block and verifies that the specified signal is NOT emitted during duration_sec.
Executes the provided block and asserts that Godot ObjectDB object and node counts return to baseline after Boehm GC collection and frame draining.
Asserts that the block does not introduce any orphan nodes (Performance::ObjectOrphanNodeCount)
Asserts that a numeric value does NOT fall within the inclusive range [min, max]
Asserts that emitter's signal has NO active connections
Asserts that a collection is not empty
Asserts that an object has NOT been freed / is alive (alias to assert_alive)
Asserts that a value is non-nil
Asserts that actual and expected do not reference the exact same object
Asserts that evaluating the block raises an exception of the expected class T
Asserts that a RefCounted instance has the expected reference count
Asserts that actual and expected reference the exact same object
Asserts that a SignalSpy recorded exactly the expected number of emissions (backwards compatibility)
Asserts that a SignalSpy recorded exactly count emissions
Asserts that a SignalSpy recorded at least one emission
Asserts that a SignalSpy did NOT record any emissions
Asserts that string contains the specified substring
Asserts that string ends with the specified suffix
Asserts that string starts with the specified prefix
Asserts that the boolean condition evaluates to true
Asserts that an instance ID is currently valid in Godot's ObjectDB
Asserts that two Vector2 values are approximately equal within epsilon
Asserts that two Vector3 values are approximately equal within epsilon
Asserts that two Color values are approximately equal within epsilon
Registers an object to be safely disposed at the end of the test
Cooperatively awaits a signal on the target emitter.
If the signal is not received within timeout_sec, raises a descriptive TimeoutError.
Returns the emitted arguments as an Array(Variant).
Marks the currently running test as pending implementation
Deterministically simulates frames of processing on a node and its recursive children
Cooperatively yields until the specified number of process (render/idle) frames have elapsed
Conditionally skips the currently running test if condition evaluates to true
Cooperatively yields until the specified number of fixed physics frames have elapsed
Temporarily suppresses engine error printing to stdout/stderr while evaluating the block
Registers a node to be automatically destroyed and cleaned up in after_each
Safely creates a node of type T, yields it to the block, and guarantees destruction
Executes a block with an active timeout watchdog, raising TimeoutError if it fails to finish in time