MikeSchulze / gdUnit3

A Godot Unit Test Framework. Support for gdScript and c# unit testing
MIT License
312 stars 22 forks source link

GD-341: Using a dictionary parameter in parameterized tests results into a runtime error #341

Closed ZodmanPerth closed 1 year ago

ZodmanPerth commented 1 year ago

Bug description I want to define a parameterised test where the parameter array contains a Dictionary value. e.g.:

func test_getRelativePositionOfPoint(
    message : String,
    point : Vector2,
    expectedClosestPart : int,
    expectedHitTestResult : int,
    expectedPartToEdgeMultiplier : Vector2,
    expectedDistanceToEdges: Dictionary,
    test_parameters : Array = [
        [ "center", Vector2(150,150), Rectangle2X.Part.center, Rectangle2X.HitTestResult.on, Vector2( 0, 0), { test = "value"}  ]
    ]
) -> void:

Currently running a Parameterised test with a Dictionary parameter causes a runtime error: Can't fully extract function signature of 'func test_getRelativePositionOfPoint('

Describe the solution you'd like I want to write a parameterised test that contains Dictionary parameters. The parser should understand all ways to create Dictionary values; e.g. { "test1": "value1", test2 = "value2" }

Describe alternatives you've considered Currently I have to convert the dictionary contents to an indexed array, or add a separate parameter for each dictionary entry.

Additional context None.

MikeSchulze commented 1 year ago

Thanks for reporting this issue. This is an bug, it should be allowed to use any type. I convert it to a bug issue.