Skip to main content

Testing strategy

Core logic is tested without a GUI, a network or installed language servers. CI runs every suite on Linux.

AreaWhereWhat it proves
Edits, undo/redo, dirty state, revisionside-text unit testsTransactions, coalescing, undo to saved state is clean, invalid edits change nothing
Unicode and coordinateside-text position, document testsChar/byte/UTF-16 conversions with multibyte text, clamping, empty files
Line endings, BOM, binary, sizeide-text document testsRound-trips and clear refusals
Language detection, syntaxide-languages unit testsDetection, grammar compatibility, incremental parse equals full parse, budgeted parse keeps the old tree
Language-service lifecycleide-languages/tests/lsp_lifecycle.rsLazy start, sharing, grace-period reuse, eviction, missing server, crash restart and give-up, shutdown
Extensionside-extensions testsManifest validation, compatibility, discovery, enable/disable, qualified contributions
Configuration, trust, profiles, themeside-core unit testsDefaults, invalid files, persistence, overrides
Workspace and fileside-core unit testsLazy listing, exclusions, symlink cycles, permissions, atomic saves preserving links and modes
End-to-end sessionide-core/tests/session.rsTrust gating, shared server, diagnostics and definition through the fake server, conflict handling, extension contributions, profiles, large files
AI boundaryide-ai testsPreview equals what is sent, cancellation, failures, real HTTP/SSE parsing against a local test server

Conventions​

  • Use tempfile directories and the fake language server; never the developer's home directory or the network.
  • Waiting on asynchronous results uses polling with a deadline, never a fixed sleep that the test depends on.
  • A bug fix starts with a failing test when practical.
  • Do not weaken an assertion or mark a test #[ignore] to make CI pass. #[ignore] is reserved for opt-in tests that need external tools, with the reason in the attribute.
  • Performance is measured with benchmarks, not asserted in unit tests.

The desktop UI has no automated tests yet. Changes to it are verified manually (screenshots under Xvfb are fine) and described in the pull request; a UI test harness is on the backlog.