Repository navigation
Generate strain's test suite from the canonical data - #1011
Conversation
Add .meta/template.j2 and generate the suite with AnyFunSuite in place of the AnyFlatSpec one. The template turns the canonical pseudocode predicates into Scala lambdas. Include the three canonical cases tests.toml excluded without a reason: "keeps nothing", "discards everything" and "discards nothing". The other cases now use the canonical inputs, e.g. "zealot" for "zelot". Rewrite the example in Scala 3 with foldRight, without the library's filter, and give the empty stub the `keep` and `discard` signatures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
|
Hello 👋 Thanks for your PR. This repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed. If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track. Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum. (cc @exercism/cross-track-maintainers) |
strain's template worked out the Scala type of a list's elements in a macro. Move that into the generator as a `scala_type` filter, next to `scala`, so other templates can use it: Boolean, Int (Long beyond Int's range), Double, String, and List and Map typed from their first entry. strain's rendered suite, and every other generated suite, is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
strain's suite is now generated from the canonical data by
.meta/template.j2, withAnyFunSuitein Scala 3 syntax in place of theAnyFlatSpecone."fn(x) -> starts_with(x, 'z')"); the template maps each of the six to a Scala lambda (x => x.startsWith("z")). The element type is passed explicitly, as before:Strain.keep[Int](list, ...).tests.tomlwithout a reason and are now included: "keeps nothing", "discards everything" and "discards nothing". They fit the track's API._ => trueinstead ofx < 10, and "zealot" replaces "zelot".The example is rewritten in Scala 3 with
foldRight, without the library'sfilterthe instructions rule out, anddiscardiskeepwith the predicate negated. The stub, which was empty, now declareskeepanddiscard.The previous example passes the new suite (14 tests). Cases are added, so solutions will be re-run.
Part of #488, #843 and #914.
🤖 Generated with Claude Code