Closed BNAndras closed 9 months ago
It seems solution_script
is an object with a reference count so I can't create new robot simulator instances with it.
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:
solution_script.Robot.new()
_init()
) to set up the robot, but instead set specific variables in the following lines (e.g. solution_script.direction = "up"
)Which do you prefer?
I think the former would be better.
Just rebasing the PR at the moment. I'll work on the exercise tonight.
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.
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 :)
Tests are detected and run successfully.
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.