Files
jpmschweitzerandClaude Opus 4.6 61e0762a84 chore(client): add gdUnit4 test framework addon
Vendor gdUnit4 for Godot 4 client testing (D-030).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 16:52:00 +01:00

38 lines
1.1 KiB
GDScript

# GdUnit generated TestSuite
class_name GdUnitResultTest
extends GdUnitTestSuite
# TestSuite generated from
const __source = 'res://addons/gdUnit4/src/core/GdUnitResult.gd'
func test_serde() -> void:
var value := {
"info" : "test",
"meta" : 42
}
var source := GdUnitResult.success(value)
var serialized_result := GdUnitResult.serialize(source)
var deserialised_result := GdUnitResult.deserialize(serialized_result)
assert_object(deserialised_result)\
.is_instanceof(GdUnitResult) \
.is_equal(source)
func test_or_else_on_success() -> void:
var result := GdUnitResult.success("some value")
assert_str(result.value()).is_equal("some value")
assert_str(result.or_else("other value")).is_equal("some value")
func test_or_else_on_warning() -> void:
var result := GdUnitResult.warn("some warning message")
assert_object(result.value()).is_null()
assert_str(result.or_else("other value")).is_equal("other value")
func test_or_else_on_error() -> void:
var result := GdUnitResult.error("some error message")
assert_object(result.value()).is_null()
assert_str(result.or_else("other value")).is_equal("other value")