一键导入
rust-unit-tests
Write, improve, and run Rust unit tests in the warp Rust codebase.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Write, improve, and run Rust unit tests in the warp Rust codebase.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Fetch and display GitHub PR review comments for the current branch.
**MANDATORY prerequisite** — you MUST invoke this skill BEFORE every `use_figma` tool call. NEVER call `use_figma` directly without loading this skill first. Skipping it causes common, hard-to-debug failures. Trigger whenever the user wants to perform a write action or a unique read action that requires JavaScript execution in the Figma file context — e.g. create/edit/delete nodes, set up variables or tokens, build components and variants, modify auto-layout or fills, bind variables to properties, or inspect file structure programmatically.
Guides testing Warp UI features and changes using the computer use tool. Use this skill only when the computer_use tool is available to the agent. Covers launching Warp and verifying UI behavior.
Repo-specific review guidance for warp. Only the categories declared overridable by the core review-pr skill may be specialized here.
Control and inspect the currently running local Warp application with the warpctrl CLI. Use this skill whenever the user asks the agent to manipulate Warp's own windows, tabs, panes, sessions, input buffer, themes, or UI surfaces; open a file in Warp; inspect local Warp state; or explain how to invoke Warp Control manually.
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
| 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:
./script/format
cargo clippy --workspace --all-targets --all-features --tests -- -D warnings
For a full local check before a PR, you can also run:
./script/presubmit