| 📦 Turbo Rust 713ea5c k33g 11h ago | 1 | # How to run the tests |
| 2 | |
| 3 | This guide shows how to run and read Turbo Rust's test suite. It assumes you have a checkout and Go 1.26 or later. |
| 4 | |
| 5 | ## The whole suite |
| 6 | |
| 7 | ```bash |
| 8 | make test |
| 9 | ``` |
| 10 | |
| 11 | That is the single documented command. It runs `cargo test` across every package. |
| 12 | |
| 13 | ## Variants |
| 14 | |
| 15 | **See each test by name:** |
| 16 | |
| 17 | ```bash |
| 18 | make test-verbose |
| 19 | ``` |
| 20 | |
| 21 | **Measure coverage per package:** |
| 22 | |
| 23 | ```bash |
| 24 | make cover |
| 25 | ``` |
| 26 | |
| 27 | **One package only:** |
| 28 | |
| 29 | ```bash |
| 30 | go test ./internal/buffer/ |
| 31 | ``` |
| 32 | |
| 33 | **Without starting a language server.** One test in `internal/lsp` starts a real `rust-analyzer` when it finds one. To skip it: |
| 34 | |
| 35 | ```bash |
| 36 | go test -short ./... |
| 37 | ``` |
| 38 | |
| 39 | **With the race detector.** The LSP client is concurrent, so this is worth running before touching it: |
| 40 | |
| 41 | ```bash |
| 42 | go test -race ./internal/lsp/ |
| 43 | ``` |
| 44 | |
| 45 | **Everything a commit should pass:** |
| 46 | |
| 47 | ```bash |
| 48 | make check |
| 49 | ``` |
| 50 | |
| 51 | This runs `go fmt`, `go vet` and the tests, in that order. |
| 52 | |
| 53 | ## What the suite covers |
| 54 | |
| 55 | No test needs a real terminal. The widgets and the editor are drawn onto tcell's `SimulationScreen` — a real `Screen` that draws into memory — so the assertions are made on the picture a terminal would actually show. The LSP client is driven against a language server running in the same process, over an in-memory pipe. |
| 56 | |
| 57 | The one exception is `TestAgainstRealGopls`, which starts the real thing. It **skips itself** when `rust-analyzer` is not installed, so a checkout without one still has a green suite. |
| 58 | |
| 59 | ## Testing against an unreleased turbo-core |
| 60 | |
| 61 | Most of Turbo Rust is turbo-core, and this repository depends on it by version, from the module proxy: |
| 62 | |
| 63 | ``` |
| 64 | require rickub.com/turbo-editors/turbo-core v0.2.0 |
| 65 | ``` |
| 66 | |
| 67 | A change made in a turbo-core checkout beside this one is therefore invisible here until it is published. To test it before that, make a workspace: |
| 68 | |
| 69 | ```bash |
| 70 | go work init . ../turbo-core |
| 71 | make test |
| 72 | ``` |
| 73 | |
| 74 | Every import of the library now resolves to that checkout. Nothing in `go.mod` or `go.sum` changes, so there is no edit to undo. Check it took effect — this is the mistake worth guarding against, because everything still builds and still passes if it did not: |
| 75 | |
| 76 | ```bash |
| 77 | go list -f '{{.Dir}}' rickub.com/turbo-editors/turbo-core/app |
| 78 | ``` |
| 79 | |
| 80 | The answer should be your checkout, not a path under `pkg/mod`. When you are done, `rm go.work go.work.sum`; it is gitignored, so it cannot be committed by accident. |
| 81 | |
| 82 | ## Code quality |
| 83 | |
| 84 | The test suite is not the whole gate. Quality is measured separately: |
| 85 | |
| 86 | ```bash |
| 87 | python3 ~/.claude/skills/quality/scripts/quality_report.py --workspace . |
| 88 | ``` |
| 89 | |
| 90 | It writes a report under `.quality/` and exits non-zero if the gate fails. |
| 91 | |
| 92 | ## See also |
| 93 | |
| 94 | - Why the tests are shaped this way: [Architecture](../explanation/architecture.md) |
| 95 | - Every make target: [command line reference](../reference/cli.md) |