abc2midi: allow %%MIDIdef macros to be defined anywhere (#23)

* abc2midi: allow %%MIDIdef macros to be defined anywhere

Fix also some lost CHANGES from previous commit.

abc2midi: allow %%MIDIdef macros to be defined anywhere, including before the first X: field (outside any tune). Previously %%MIDIdef was only handled inside event_specific() after the started_parsing check,so macros defined in the file header were silently ignored.
The %%MIDIdef handling has been moved before the started_parsing check in event_specific() in store.c since macro definitions are context-independent.

* Update the golden test files since X:, R: and C: are now emitted
This commit is contained in:
Ronan Keryell
2026-04-23 06:21:48 -07:00
committed by GitHub
parent 22ad87cd72
commit 6ecbbde0fd
7 changed files with 84 additions and 7 deletions

View File

@@ -61,3 +61,30 @@ Available presets:
The CMake build generates `compile_commands.json` for use with
clangd and other LSP-based editors.
### Testing
The CMake build includes a test suite covering all 8 programs:
- **Smoke tests** verify each binary runs cleanly with `-ver`.
- **Golden-file tests** run each program on a sample input and compare the
(normalized) output to a checked-in reference. Binary MIDI outputs are
piped through `mftext` to produce diffable text. Volatile lines (version
banners, dates, temporary paths) are stripped before comparison.
```sh
# Run all tests
ctest --preset debug
# Run only golden-file tests / only smoke tests
ctest --preset debug -L golden
ctest --preset debug -L smoke
```
To regenerate the golden files after an intentional behavioural change,
review the diff, then commit:
```sh
cmake --build build/debug --target update-golden
git diff tests/golden/
```