4. Project: a tested scorecard
Build archer-score, a small program that totals three round scores and rejects
values outside the event’s accepted range. Keep validation and total calculation
in score.fl, entry-point formatting in main.fl, and success plus failure
cases in score_test.fl.
Qualification is the project: longbow check must accept the complete graph,
longbow test must cover the boundary scores and one invalid score, and
longbow run must print one stable result. Change one invalid input and confirm
the program returns a documented nonzero status instead of silently clamping it.
This project is deliberately small enough to review in one sitting. Its value is the separation of contracts: modules own names, functions own validation, the entry point owns diagnostics, and tests own evidence.
Tested example
Turn one public function into a tested package and exercise the same build boundary used by publication.
Excerpt in focus
curriculum/fixtures/package-dry-run/src/archer_words_test.fl:1–11
module archer_words_test;
@imports :: root::archer_words :: lib::std::tests::testing;
test reports_greeting_length(&testing::UnitTest t) { if archer_words::greeting_length() != 6 { t->fail(); }}This excerpt depends on the other package files. The complete compiled source is available below.
Complete package source (3 files)
longbow.toml
[package]name = "archer-words"registry = "flecha-docs/archer-words"version = "0.1.0"kind = "library"
[dependencies]src/archer_words.fl
module archer_words;
export i32 greeting_length() { return 6;}src/archer_words_test.fl
module archer_words_test;
@imports :: root::archer_words :: lib::std::tests::testing;
test reports_greeting_length(&testing::UnitTest t) { if archer_words::greeting_length() != 6 { t->fail(); }}The excerpt is one test module inside a Longbow package. The complete bundle shows the public function and manifest that the test depends on; the commands check that package boundary rather than an isolated file.
Commands
longbow check curriculum/fixtures/package-dry-runlongbow test curriculum/fixtures/package-dry-runlongbow build curriculum/fixtures/package-dry-runExpected output
archer_words_test.fl ............................... OK [1/1] tests passedexit status: 0Related reference: /docs/reference/package_qualification/.
Track complete
Section titled “Track complete”Continue to Intermediate: ownership, moves, and checked borrows. Browse complete examples when you want more syntax in context.