Skip to content

Commit

Permalink
Update contributing section (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
BNAndras authored Oct 4, 2023
1 parent a521709 commit 1148b99
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,52 @@ This command will iterate over all exercises and check to see if their exemplar/
Please see [Exercism's contributing guide](https://exercism.org/docs/building).

At the moment, there's not a generator for Pyret exercises.
Make sure `use context essentials2020` is the first line in all Pyret files to explicitly set the default namespace.

Here's the basic template for an `exercise-slug-test`.arr.
Each `check` block corresponds to a single test case, and the string label is reported to the student.
Each `check` block is wrapped inside a no-parameter function which is then stored inside the `run` field of a `test` value of the `TestRun` datatype.
This `test` value also contains an `active` field which indicates whether a test should be run (`true`) or not (`false`).
All `test` values go inside a list that Pyret iterates over at runtime, executing the functions within each `test` value marked as active.

A contributor is responsible for copying this template, adding the appropriate functions and `check` blocks, and populating the list at the bottom.

```pyret
use context essentials2020
include file("exercise-slug.arr")
#|
When working offline, all tests except the first one are skipped by default.
Once you get the first test running, unskip the next one until all tests pass locally.
Check the block comment below for further details.
|#
fun foo-returns-1():
check "foo returns 1":
foo() is 1
end
end
fun bar-returns-2():
check "bar returns 2":
bar() is 2
end
end
#|
Code to run each test. Each line corresponds to a test above and whether it should be run.
To mark a test to be run, replace `false` with `true` on that same line after the comma.
test(test-a, true) will be run. test(test-a, false) will be skipped.
|#
data TestRun: test(run, active) end
[list:
test(foo true),
test(bar, false),
].each(lam(t): when t.active: t.run() end end)
```

## Track linting

Expand Down

0 comments on commit 1148b99

Please sign in to comment.