Write regression tests that (1) are portable across platforms where behavior is shared and (2) are “behaviorally decisive,” meaning they must fail if the real logic is removed.
Apply:
cfg gates for shared behavior (e.g., #[cfg(unix)]) rather than narrow OS-specific gates in core modules.Example (portability + decisive setup):
#[cfg(unix)]
#[test]
fn preserves_selection_after_close_requiring_reconciliation() {
// Arrange: 3 workspaces so the survivor index shifts
// e.g., [background (only tab), middle, active (selected)]
// Act: close background's last tab
// Assert: selected workspace is updated by reconciliation logic,
// and the test would fail if focus/selection reconciliation were removed.
}
This standard prevents flaky/overly restrictive platform gating and ensures regression tests actually guard the behavior you care about.