Files
akbasic/tests/reference/README.md

50 lines
2.6 KiB
Markdown
Raw Normal View History

# The reference interpreter's own test corpus
These 41 `.bas` files and their 41 `.txt` expectations are **not this project's tests.** They
are a byte-for-byte copy of the acceptance corpus belonging to the Go implementation this
interpreter was ported from:
| | |
|---|---|
| Source | `https://source.starfort.tech/andrew/basicinterpreter`, `tests/` |
| Copied at | commit `d76162cb37eeaccddae2cf6cab7af7bc8175d6d2` ("Update README.md") |
| Copied on | 2026-07-31 |
| Verified | every file `cmp`-identical to the submodule at the time of the copy |
They are registered as the `golden_*` CTest cases and run against `basic` on every build, in
both the default and the `-DAKBASIC_WITH_AKGL=ON` configurations.
## Why they are a copy now, when they deliberately were not
Until 2026-07-31 these were driven *in place* out of `deps/basicinterpret`, and the reasoning
was written down in `CMakeLists.txt`: the corpus is a submodule, and copying a submodule's
corpus guarantees drift.
That reasoning was sound. It was overruled on purpose, because the Go dependency is being
deprecated and a build that cannot run its own acceptance suite without cloning the
implementation it replaced is not finished.
**What the change costs, stated plainly so nobody has to rediscover it:** if the Go
implementation ever gains a test, this directory will not. There is no longer anything
watching for that. The trade is deliberate — the Go project is the thing being retired, so a
corpus that stops tracking it is a corpus that stopped tracking something that stopped moving.
## The rule for editing these
**Don't.**
This directory is a *record of what the Go implementation did*, and it is what makes the claim
"reproduces the reference byte for byte" checkable at all. A failure here means this
interpreter's behaviour changed, and the answer is to change this interpreter or to record a
deliberate deviation in `TODO.md` §5 — never to edit the expectation to match.
New cases for this project's own behaviour go in `tests/language/`, which is registered under
`local_*` for exactly this reason: the prefix says which corpus a failure came from, and a diff
that touches `tests/reference/` stands out as the thing it is.
There is one case worth knowing about before anybody "fixes" it.
`examples/strreverse.bas` names a variable `INPUT$`, which a real Commodore 128 would refuse
and which this interpreter accepts only because the reference's reserved-word check never
fires. That is `TODO.md` §6 item 16, and it is the reason that item is filed as a decision
rather than a defect: making the check work costs this case.