wip(0.S1, 0.S2): state records, mut and read-only state parameters, entry injection, module var refused; ludic migrate state
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
63a1fa1378
commit
1e8b5b0523
35 changed files with 1227 additions and 30 deletions
14
examples/state/tested.ludic
Normal file
14
examples/state/tested.ludic
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# tested.ludic — 0.S: a test declares the states it uses, `test "name" (c: mut Tally)`, and gets a
|
||||
# fresh one (each test is a process of its own). Its runner prints:
|
||||
# == 2 passed, 0 failed ==
|
||||
program Tested {
|
||||
state Tally { n: int = 0 }
|
||||
function bump(c: mut Tally) -> void { c.n += 1 }
|
||||
test "a bump counts one" (c: mut Tally) {
|
||||
bump(c)
|
||||
expect_eq(c.n, 1)
|
||||
}
|
||||
test "reading needs no mut" (c: Tally) {
|
||||
expect_eq(c.n, 0)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue