Apps

Tests

# Deft Tests A two-pane test browser and runner: test list (top) + results output (bottom). Enumerate `defsuite`/`deftest` blocks for the focused source file's test file and run them via `deft test`. ## Test Discovery When a `.dft` file is focused in the editor, the panel looks for its test file using the convention `<dir>/<base>.dft` → `<dir>/test/test_<base>.dft`. If the focused file is itself a test file (basename starts with `test_`), its tests are enumerated directly. The filter bar at the bottom is dormant by default — press `/` to enter filter mode, type to narrow the list by substring match, then `Escape` to exit. Panel shortcuts (`r`, `g`, `f`, `v`, etc.) only fire when filter mode is off, so they never collide with typing. ## Key Bindings ### Default Mode | Key | Action | |-----|--------| | `Up` / `Down` | Move selection (or scroll results when results pane is focused) | | `Page Up` / `Page Down` | Move/scroll by a page | | `Home` / `End` | Jump to first / last row | | `Enter` | Run the test (or suite) under the cursor via `deft test --only` | | `r` | Run every test in the file | | `g` | Open the test file in the editor | | `f` | Jump editor cursor to the selected test's source line | | `v` | Toggle the results pane | | `Tab` | Switch focus between list and results panes | | `/` | Enter filter mode | | `Escape` | Clear filter, hide results pane, or return focus to the list | ### Filter Mode Active after pressing `/`. The query is shown at the bottom row with a trailing cursor; matching tests/suites are filtered incrementally. | Key | Action | |-----|--------| | printable chars | Append to the filter query | | `Backspace` | Delete the last query character | | `Up` / `Down` / `Page Up` / `Page Down` / `Home` / `End` | Navigate the filtered list | | `Enter` | Exit filter mode and run the selected row | | `Escape` | Exit filter mode (query preserved) | Mouse scroll within a pane scrolls that pane only; clicking a row in the list selects it and jumps the editor cursor to its definition. ## Running Tests - `Enter` runs only the selected row. For a suite row, every test in that suite runs. For a test row, only that single test runs (matched by its `<suite>::<name>` key, so ambiguous test names across suites still resolve correctly). - `r` runs the whole file. Per-test statuses from previous runs are preserved when running a subset; run-all naturally refreshes everything. - Output is captured from the runner's stderr (it writes via `std.debug.print`) and colourised: suite headers in cyan, `✓` passes in green, `✗` failures in red, the summary line in keyword colour.