The online test runner times out on the Diamond exercise when a student uses any character besides the expected _ for spaces in the outputted diamond. I pulled the test runner Docker image locally and tested OP’s code, and it completed very quickly. I tested the example solution in the online editor, and it passed. I changed the spacing character for the example solution, and it timed out. I repeated that again yesterday and tonight with the same results.
If I’m correct about the spacing character, I think the culprit is the last test in particular. Elm creates a diff between the expected and result values and the expected output is 51 lines with 51 characters, most of which are the spacing. So even if the diff is just the spacing, that’s a lot to mark up and might be contributing to this time-out.
I don’t think it’s necessary to change the test, this is only likely to happen when students mistake the spacing character.
I could reproduce the issue, by replacing the “external” spacing characters (__B_B__ to --B_B--), the tests take a long time and fail, and by replacing the internal ones as well (--B-B--) it times out.
Something is wrong somewhere, and I think the issue is in elm-test-rs.
diamond git:(main) ✗ time elm-test-rs
Running 5 tests. To reproduce these results later,
run elm-test-rs with --seed 2964164440 and --fuzz 100
[... test results go here...]
TEST RUN FAILED
Duration: 2 ms
Passed: 1
Failed: 4
elm-test-rs 4.98s user 0.40s system 100% cpu 5.359 total
The test suite runs in 2ms, but it takes 5 seconds to print the results.
I opened an issue on the elm-test-rs repo, hopefully something can be done about this, but I must confess I’ll be unable to help as I’m not familiar with the internals of the elm-test-rs, and I don;t know Rust.