The previous tests never compiled: they used GUT's assert functions, Godot 3 APIs and reassigned autoload functions, so no test ran. - 90 tests: unit tests for the playlist, songs, player scoring, time formatting, search and the server client, plus integration tests that run MainWindow and SyncWindow against a fake server - Keybind tests check that Alt+<number> and Ctrl+Alt+<number> keep following the player rows while players are added and removed - run_tests.sh finds Godot and runs the suite headless (~10 seconds) - CI runs the tests before the build job in gitea-build.yaml; the separate test.yml used a GitHub action that does not exist - GdUnit4 is committed instead of ignored, since the project enables it, and .gitea/ is no longer ignored - Exported builds leave out tests/ and addons/gdUnit4/
48 lines
1.7 KiB
GDScript
48 lines
1.7 KiB
GDScript
## Base interface of all GdUnit asserts
|
|
@abstract class_name GdUnitAssert
|
|
extends RefCounted
|
|
|
|
|
|
## Verifies that the current value is null.
|
|
@abstract func is_null() -> GdUnitAssert
|
|
|
|
|
|
## Verifies that the current value is not null.
|
|
@abstract func is_not_null() -> GdUnitAssert
|
|
|
|
|
|
## Verifies that the current value is equal to expected one.
|
|
@abstract func is_equal(expected: Variant) -> GdUnitAssert
|
|
|
|
|
|
## Verifies that the current value is not equal to expected one.
|
|
@abstract func is_not_equal(expected: Variant) -> GdUnitAssert
|
|
|
|
|
|
## Overrides the default failure message by given custom message.[br]
|
|
## This function allows you to replace the automatically generated failure message with a more specific
|
|
## or user-friendly message that better describes the test failure context.[br]
|
|
## Usage:
|
|
## [codeblock]
|
|
## # Override with custom context-specific message
|
|
## func test_player_inventory():
|
|
## assert_that(player.get_item_count("sword"))\
|
|
## .override_failure_message("Player should have exactly one sword")\
|
|
## .is_equal(1)
|
|
## [/codeblock]
|
|
@abstract func override_failure_message(message: String) -> GdUnitAssert
|
|
|
|
|
|
## Appends a custom message to the failure message.[br]
|
|
## This can be used to add additional information to the generated failure message
|
|
## while keeping the original assertion details for better debugging context.[br]
|
|
## Usage:
|
|
## [codeblock]
|
|
## # Add context to existing failure message
|
|
## func test_player_health():
|
|
## assert_that(player.health)\
|
|
## .append_failure_message("Player was damaged by: %s" % last_damage_source)\
|
|
## .is_greater(0)
|
|
## [/codeblock]
|
|
@abstract func append_failure_message(message: String) -> GdUnitAssert
|