| 1 | module main |
| 2 | |
| 3 | import state |
| 4 | |
| 5 | fn main() { |
| 6 | mut counter := state.new_counter('jobs') |
| 7 | assert counter.value == 0 |
| 8 | assert counter.inc() == 1 |
| 9 | assert counter.inc() == 2 |
| 10 | assert counter.value == 2 |
| 11 | |
| 12 | counter.label = 'builds' |
| 13 | assert counter.label == 'builds' |
| 14 | |
| 15 | // This must stay rejected outside module `state`: |
| 16 | // counter.value++ |
| 17 | } |
| 18 |