F4: Headless test harness
Add an in-repo test runner that discovers test/**/test_*.gd and runs under --headless. It uses Godot's Logger API, so engine and script errors during a test fail that test. make test runs the suite, and make test-selfcheck runs deliberately failing fixtures to prove each kind of failure is detected. Closes #4 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vendored
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
extends TestCase
|
||||
|
||||
|
||||
func test_failing_assertion() -> void:
|
||||
assert_eq(1 + 1, 3, "deliberate fixture failure")
|
||||
Vendored
@@ -0,0 +1,8 @@
|
||||
extends TestCase
|
||||
|
||||
|
||||
func test_engine_error() -> void:
|
||||
var node: Node = Node.new()
|
||||
# The engine reports a parameter error and carries on.
|
||||
node.add_child(null)
|
||||
node.free()
|
||||
@@ -0,0 +1,5 @@
|
||||
extends TestCase
|
||||
|
||||
|
||||
func test_declared_error_never_happens() -> void:
|
||||
expect_error("an error that is never raised")
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
extends RefCounted
|
||||
|
||||
|
||||
func test_wrong_base_class() -> void:
|
||||
pass
|
||||
@@ -0,0 +1,5 @@
|
||||
extends TestCase
|
||||
|
||||
|
||||
func test_does_not_parse() -> void
|
||||
this is not valid GDScript
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
extends TestCase
|
||||
|
||||
|
||||
func test_passes() -> void:
|
||||
assert_true(true)
|
||||
assert_eq(1 + 1, 2)
|
||||
assert_near(0.1 + 0.2, 0.3, 0.0001)
|
||||
|
||||
|
||||
func test_expected_engine_error_does_not_fail() -> void:
|
||||
expect_error("deliberate fixture error")
|
||||
push_error("deliberate fixture error")
|
||||
|
||||
|
||||
func test_may_await() -> void:
|
||||
await Engine.get_main_loop().process_frame
|
||||
assert_true(true)
|
||||
@@ -0,0 +1,6 @@
|
||||
extends TestCase
|
||||
|
||||
|
||||
func test_null_dereference() -> void:
|
||||
var missing: Node = null
|
||||
missing.get_name()
|
||||
Reference in New Issue
Block a user