NovaSharp

NovaSharp Testing Guide

NovaSharp ships with a comprehensive test suite that blends historical Lua fixtures with .NET focused regression checks.

Test Topology

Running the Tests Locally

DOTNET_ROLL_FORWARD=Major dotnet test \
  --project src/tests/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit/WallstopStudios.NovaSharp.Interpreter.Tests.TUnit.csproj \
  -c Release --report-trx --report-trx-filename NovaSharpInterpreterTUnit.trx

Microsoft.Testing.Platform runner

TUnit-first policy

Build Helper Scripts

Use the helpers in scripts/build when you need the canonical build + interpreter-test pipeline in a single command (matching the CI lane).

pwsh ./scripts/build/build.ps1
bash ./scripts/build/build.sh

Lint guards for test infrastructure

Generating Coverage

pwsh ./scripts/coverage/coverage.ps1

Coverage in CI

Cross-Platform CI Matrix

Pass/Fail Policy

Production Bug Policy

CRITICAL: Never adjust tests to accommodate production bugs. When a test fails or exposes incorrect behavior:

  1. Assume production is wrong until proven otherwise
  2. Fix the production code to produce correct output
  3. Keep tests unchanged unless they are demonstrably incorrect
  4. Verify against specification (Lua manual, DAP protocol spec, etc.)
  5. Document the fix in commit message and PR notes

This applies to all bugs, including:

If you discover a production bug while writing tests, fix the production code first, then verify the test passes with correct behavior. Never work around bugs with test accommodations.

Naming & Conventions

Expanding Coverage

  1. Deepen unit coverage across parser error paths, metatable resolution, and CLI tooling to raise the interpreter namespace above 70 % line coverage.
  2. Introduce debugger protocol integration tests (attach, breakpoint, variable inspection) and capture golden transcripts for the CLI shell.
  3. Keep Lua fixtures under version control in src/tests/WallstopStudios.NovaSharp.Interpreter.Tests to avoid drift and simplify regeneration.
  4. Restore the skipped OS/IO TAP fixtures through conditional execution in trusted environments or provide managed equivalents.
  5. Restore interactive debug.debug REPL-loop coverage after fixing the nested ReplInterpreter/ProcessingLoop state failure; null-input exit and prompt behavior remain covered separately.

Track only selected goals in PLAN.md; keep the complete testing gaps and shipped policies in this document and record completed work in progress/.

Analyzer & Warning Policy

Debugger Analyzer Guardrails

Both debugger stacks now rely on analyzers to catch regressions; any new warning fails the Release build, so keep the following guardrails in mind whenever you touch debugger code.

Validation checklist:

dotnet build src/debuggers/WallstopStudios.NovaSharp.VsCodeDebugger/WallstopStudios.NovaSharp.VsCodeDebugger.csproj -c Release -nologo
dotnet build src/debuggers/WallstopStudios.NovaSharp.RemoteDebugger/WallstopStudios.NovaSharp.RemoteDebugger.csproj -c Release -nologo
$env:DOTNET_ROLL_FORWARD = 'Major'
dotnet test --project src/tests/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit/WallstopStudios.NovaSharp.RemoteDebugger.Tests.TUnit.csproj -c Release

Document new suppressions or analyzer exclusions in the closest authoritative analyzer documentation (with the CA rule, justification, and follow-up owner) before merging.