1
0
Fork 0
forked from fun/fun

Holiday is over, now I have fun again. No code changes. (0.38.11)

This commit is contained in:
Johannes Findeisen 2026-02-18 17:39:10 +01:00
commit f896e1d3bf
13 changed files with 329 additions and 0 deletions

24
docs/writing-tests.md Normal file
View file

@ -0,0 +1,24 @@
# Writing Tests
How to author tests for Fun and its opcode implementations.
## Test kinds
- VM/opcode tests: exercise bytecode operations and VM behavior (target: `test_opcodes`).
- Language/runtime tests: exercise user-visible features and stdlib behavior (target: `fun_test`).
See `docs/testing.md` for how to build and run these targets with CTest.
## Adding new tests
The exact layout may evolve; generally:
- Add new test sources alongside existing ones used by `fun_test`.
- For opcode-focused tests, add cases where `test_opcodes` discovers them.
Aim for:
- Small, isolated test cases with clear assertions
- One behavior per test; descriptive names
- Minimal fixtures and setup
## Guidelines
- Prefer black-box testing via public APIs.
- When adding features, include both positive and negative cases.
- Keep tests deterministic; avoid non-deterministic timers or random sources unless seeded.