MikeSchulze / gdUnit4

A Godot Unit Test Framework. Support for GDScript and C# unit testing
MIT License
490 stars 28 forks source link

GD-517: Test discovery guard fails on `CSharpScript` tests when editing #517

Closed MikeSchulze closed 1 week ago

MikeSchulze commented 1 week ago

The used GdUnit4 version

4.3.2 (Latest Release)

The used Godot version

v4.2.2.stable.mono.official [15073afe3]

Operating System

All

Describe the bug

The test discovery fails on CS test suites during editing. The guard is expecting script type GDScript where is failing for CSharpScript type.

Dev Hints

res://addons/gdUnit4/src/core/discovery/GdUnitTestDiscoverGuard.gd

func discover(script: Script) -> void:
    if GdObjects.is_test_suite(script):
        # a new test suite is discovered
        if not _discover_cache.has(script.resource_path):
            var scanner := GdUnitTestSuiteScanner.new()
            var test_suite := scanner._parse_test_suite(script)

The parser expects GDScript and do fail by

res://addons/gdUnit4/src/core/discovery/GdUnitTestDiscoverGuard.gd:27 - Invalid type in function '_parse_test_suite' in base 'RefCounted (GdUnitTestSuiteScanner)'. The Object-derived class of argument 1 (CSharpScript) is not a subclass of the expected argument class.

Steps to Reproduce

res://addons/gdUnit4/src/core/discovery/GdUnitTestDiscoverGuard.gd:27 - Invalid type in function '_parse_test_suite' in base 'RefCounted (GdUnitTestSuiteScanner)'. The Object-derived class of argument 1 (CSharpScript) is not a subclass of the expected argument class.

Minimal reproduction project

No response