con un clic
rust-unit-tests
Write, improve, and run Rust unit tests in the warp Rust codebase.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Write, improve, and run Rust unit tests in the warp Rust codebase.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Use this skill when helping users add MCP servers to their Warp configuration.
Add a new feature flag to gate code changes in the Warp codebase.
Create a pull request in the warp repository for the current branch. Use when the user mentions opening a PR, creating a pull request, submitting changes for review, or preparing code for merge.
Repo-specific dedupe guidance for warp-external. Only the categories declared overridable by the core dedupe-issue skill may be specialized here.
Implement an approved feature from PRODUCT.md and TECH.md, keeping specs and code aligned in the same PR as implementation evolves. Use after the product and tech specs are approved and the next step is building the feature.
Promote a feature-flagged feature to Dogfood, Preview, or Stable in the Warp codebase. Use when a feature behind a FeatureFlag is ready to roll out to a broader audience, including wiring up the compile-time/runtime bridge and deferring flag cleanup safely.
| name | rust-unit-tests |
| description | Write, improve, and run Rust unit tests in the warp Rust codebase. |
${filename}_tests.rs or mod_test.rs.#[cfg(test)]
#[path = "filename_tests.rs"] // or "mod_test.rs"
mod tests;
fn parses_utf8_sequence_when_valid().assert_eq!/assert_ne! over assert! for clearer diffs.#[should_panic] only when panic semantics are intended API.model.lock() calls in the same call stack from tests.#[tokio::test] when the code requires a runtime.FeatureFlag::X.is_enabled()) over #[cfg(...)] so tests don’t require recompilation to toggle behavior.warpui::App::test for deterministic unit tests around views/models.update and assert via read.use warpui::App;
// In app crate tests prefer `crate::test_util::...`; from other crates use `warp::test_util::...`.
use warp::test_util::{terminal::initialize_app_for_terminal_view, add_window_with_terminal};
#[test]
fn example() {
App::test((), |mut app| async move {
// One-time app setup for terminal/view tests
initialize_app_for_terminal_view(&mut app); // includes settings init
let term = add_window_with_terminal(&mut app, None);
// Act
term.update(&mut app, |view, _ctx| {
view.model.lock().simulate_block("ls", "out");
});
// Assert
term.read(&app, |view, _ctx| {
assert!(view.model.lock().block_list().len() > 0);
});
})
}
TerminalModel::mock(..), .simulate_block(..), .finish_block(), .simulate_cmd(..).terminal::model::test_utils::{TestBlockListBuilder, TestBlockBuilder}.use virtual_fs::{VirtualFS, Stub};
VirtualFS::test("case", |_dirs, mut fs| {
fs.with_files(vec![Stub::FileWithContent("path/file.txt", "contents")]);
// run logic and assert
});
use warp::features::FeatureFlag; // or `use crate::features::FeatureFlag;` inside the app crate
let _flag = FeatureFlag::CreatingSharedSessions.override_enabled(true);
assert_lines_approx_eq!(actual_lines, INLINE_BANNER_HEIGHT);
model.lock() scopes minimal; avoid nested/re-entrant locks in the same call chain.initialize_settings_for_tests directly when using initialize_app_for_terminal_view (it already calls it).#[tokio::test] when a real runtime is required; otherwise prefer App::test.serial_test's #[serial] or local mocking instead of parallelism.cargo nextest run --no-fail-fast --workspace --exclude command-signatures-v2
cargo nextest run -p <crate_name>
cargo nextest run -E 'test(<substring>)'
cargo test --doc
Run before submitting changes:
cargo fmt
cargo clippy --workspace --all-targets --all-features --tests -- -D warnings
For a full local check before a PR, you can also run:
./script/presubmit