feat: show the built-in test framework on the home page - #214
Merged
Conversation
The tooling comparison table claims that flix is its own test framework, but nothing on the page showed what a test looks like. Adds a section between termination checking and Datalog: two @test functions using assertEq and assertErr from the Assert module, followed by the output of `flix test`. The example carries the Assert effect in its signature, which ties testing back to the effect system the surrounding sections build up. The output is terminal text rather than Flix, so it renders through a plain <pre> that reuses the CodeSnippet frame; the component only knows the Flix grammar and would colour the PASS lines as code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tooling comparison table further down the page claims that
flixis its own test framework, but nothing on the page showed what a test actually looks like.Adds a section between Termination Checking and First-class Datalog Constraints, text-left / code-right so the alternation across the page continues.
The example
It shows
@Test, two assertions from theAssertmodule including the labelledexpectedargument, and the\ Asserteffect — which lets the card tie testing back to the effect system the preceding twenty sections build up: asserting is an effect, so the test runner is just its handler.Underneath the snippet is the output of
flix test:Notes
The output is terminal text, not Flix, so it bypasses
CodeSnippetand renders through a plain<pre>that reuses the component's frame —CodeSnippetonly knows the Flix grammar and would colour thePASSlines as if they were code. No new CSS;overflow-xis set inline because Astro's<Code>ships that on the<pre>it renders and a bare one has nothing.Timings are written with a decimal point. The book shows
1,4ms, which is the runner picking up a Danish locale.Rebased onto #212 and #213; the diff is 62 insertions and no deletions.
npm run checkandnpm run buildboth pass.🤖 Generated with Claude Code