Skip to content

1.5.0: tests by the mcpp test spec, test sessions, tests beside each other - #11

Merged
Sunrisepeak merged 5 commits into
mainfrom
feat/test-spec
Nov 10, 2026
Merged

Sunrisepeak merged 5 commits into
mainfrom
feat/test-spec

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

mcpp-ide 1.5.0 reads tests by the mcpp test spec (mcpp docs/specs/test.md, SPEC-017 v2.0) and knows no test framework by name. Every component is 1.5.0.

Changes

  • Cases are the program's listing (B3): one mcpp test --cases per project. The listing is kept: it is listed again only when the project has changed and an editor asks (when cases are first shown, and after a build or a test). Writing a file shows the last listing and builds nothing. Cases run by identifier (--case, P4). The framework table, the static reading of cases with mtest's manifest, and mcpp.test.macros are removed.
  • Checks and output. A case carries its checks (O3: held, failed; each failure's statement and whether the case went on) and its own output (O8). VS Code shows one message per failed check.
  • Test sessions (O9). When a project's framework states test-session and its mcpp states test-launch-records, a run of some cases goes through the session. The session starts once per project and speaks JSON-RPC 2.0 over its standard streams. A run is registered when its answer is read, before any of its notifications. The session ends when its input ends, so it ends with the backend. The new setting mcpp.test.session (auto, off) chooses between the session and mcpp test.
  • Tests run beside each other. Each test job runs in its own lane, so a test does not wait for another test or a build. mcpp.runtime.concurrency now applies only to clean and pack.
  • One configuration for every test command (profile, target, mcpp.task.testArgs). Discovery is debounced. Debugging selected cases sets the protocol's variables.
  • CLion: a run configuration names a test and its cases (the framework field is removed), and the gutter puts each case's ▶ on the first element of the line the program lists for it. Neovim: case signs are listed when a file is read, when the session starts, and after a run.
  • Protocol: protocol.schema.json describes the test methods by the spec.

Compatibility

Each view depends on a feature mcpp states. With an mcpp that lacks test-protocol, a program is one case. Without test-launch-records, or without a framework that states a session, cases run through mcpp test. mcpp 2026.11.10.1 releases its build directory before tests run, so tests and builds proceed side by side.

Verification

  • Backend: mcpp test, 14 programs and 25 cases. e2e/protocol covers a session over the mock mcpp (a run, its case events with checks and output, the job's end) and the kept listing.
  • VS Code: 546 tests. Neovim: headless smoke, 0 failures.
  • A real session: the backend, mcpp 2026.11.10.1 and mtest 0.6.0 (mtest serve) on a sample project. The first run took 0.35 s; later runs took 0.07 s, with begin and end events, checks, output and failures. Killing the backend with SIGKILL leaves no session process behind.

…each other

- The backend knows no test framework (mcpp test spec, docs/specs/test.md): a program's cases are what it lists (B3), one listing of the project kept until it changes; cases run by identifier (P4) whatever framework wrote them, and a program of no protocol runs whole. spec/test-frameworks.json, the framework table, its static scanning and report readers, the setting mcpp.test.macros and the dependency on mtest's static manifest are removed; scan reads where a source starts and nothing else.
- A case's outcome carries its checks (held, failed), each failure's source and fatal (O3) and its own output (O8); VS Code shows one message per failed check, a diff where it states both sides, the statement and whether the case went on, the case's own output, and the failed checks on the case's line.
- A test runs at once in a lane of its own: two tests of a project, or a test beside a build, do not wait for each other, and cancelling one leaves the other (mcpp releases its build directory before tests run, mcpp#915). mcpp.runtime.concurrency holds only clean and pack.
- One set of arguments for every test command (profile, target, mcpp.task.testArgs), so a listing and a run plan one configuration; discovery after events is debounced.
- Debugging some cases of a protocol program states the protocol's variables and the selection.
… O9)

- Where a project's test framework states a test session (test-session, B6) and its mcpp gives launches (test-launch-records, B5), test/runCases runs the cases through it: the session is started once per project and spoken to in JSON-RPC on its standard streams; a run is a job of its own whose cases arrive as test/caseEvent with their checks, failures and output, and whose end is job/finished. Cancelling the job cancels the run.
- A run is known before the session's first notification of it: its answer is taken on the session's reading thread.
- The session ends with its input, so it ends with the backend; a lifetime bound by the system is not asked, as on Linux it follows the thread that started it.
- The setting mcpp.test.session (auto, off) runs every case through mcpp test when off.
- docs/architecture.md states a test run by the mcpp test spec.
… test spec

- test/cases answers the project's last listing without `list`, and lists again with it only when the project changed since: the cases shown stay until a listing replaces them, and writing a file builds nothing.
- CLion runs some cases of a test by their identifiers whatever framework wrote them: the run configuration names a test and its cases (its framework field is removed), and the gutter places a case's run on the first element of the line its program lists it at, in the file it names. Cases are listed when first shown and after a build or a test, one listing at a time per program.
- Neovim lists the cases when a file is read, when the session starts and after a run; writing a file shows the last listing.
- protocol.schema.json states test/cases, test/runCases, test/caseResult and test/caseEvent by the mcpp test spec: a case's checks (O3), its output (O8), a failure's source and fatal; source/entries and launch parameters name no framework.
- mcpp.lock no longer holds mcpplibs.mtest.manifest, which no target depends on.
@Sunrisepeak
Sunrisepeak merged commit 899013f into main Nov 10, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant