cpp-peglib/harness
2026-04-19 21:49:18 -04:00
..
cpp Add language independent test framework (#339) 2026-04-19 21:49:18 -04:00
rust Add language independent test framework (#339) 2026-04-19 21:49:18 -04:00
DEBUGGING.md Add language independent test framework (#339) 2026-04-19 21:49:18 -04:00
README.md Add language independent test framework (#339) 2026-04-19 21:49:18 -04:00

PEG Spec Test Harness

Language-specific test runners for the language-independent test suite in spec/tests/.

harness/
  cpp/       C++ harness (reference, uses cpp-peglib)
  rust/      Rust harness (future)

Build and run (C++)

cd harness/cpp && cmake -B build && cmake --build build
./build/spec-harness

All dependencies (googletest, nlohmann/json) are fetched automatically by CMake.

Documents

Adding a new language harness

Create harness/<lang>/ and implement a runner that:

  1. Loads each spec/tests/**/*.json file
  2. For each group, creates a parser from grammar and configures it per the group's fields
  3. Binds actions, vars, handlers, trace as defined in the schema
  4. Runs each case and verifies against the expected_* fields

Field semantics: see the JSON schema. Reference implementation: cpp/harness.cc.