exercism / gdscript

Exercism exercises in GDScript.
https://exercism.org/tracks/gdscript
MIT License
6 stars 7 forks source link

Add robot-simulator #32

Closed BNAndras closed 9 months ago

BNAndras commented 11 months ago

Decided to port over something a little more complicated. The test CI isn't picking up the tests though. Perhaps it should be a CI error if no tests are detected for the current exercise being checked.

BNAndras commented 10 months ago

It seems solution_script is an object with a reference count so I can't create new robot simulator instances with it.

pfertyk commented 10 months ago

Yeah, I was about to write a comment :) The thing is, our test runner currently loads the script and calls new() on the loaded resource. The result is RefCounted, and if you add extends Node as the first line of the solution, it will be a Node. But that's not the main issue.

Tests for this exercise call new() to create a new robot, but at this point new() was already called to create a new solution object. Calling new() again will fail. I can see 2 solutions for this:

Which do you prefer?

BNAndras commented 10 months ago

I think the former would be better.

BNAndras commented 10 months ago

Just rebasing the PR at the moment. I'll work on the exercise tonight.

BNAndras commented 10 months ago

Tests were being detected before, but now they're not being detected. I haven't changed any test names or indentation levels as far as I see. There are also two empty lines between each test case, but I think if that was the issue, surely Godot would say it can't parse the file.

pfertyk commented 9 months ago

Hi! I've copied your test suite to Godot Engine's editor and the problem is that result and expected variables need to be declared with var, so:

var expected = ...
var result = ...

I would start with that and check if the tests pass :)

BNAndras commented 9 months ago

Tests are detected and run successfully.