repositories / smith
smith
There are many coding harnesses - but this one is fast
owned by admin
smith-cli/tests/e2e_help.rs
Raw//! Help text of the built `smith` binary, pinned as snapshots
//! (`SMH-SPEC-SPEC0001`, Interface modes).
//!
//! Selection variables are removed: clap prints their current values in
//! `[env: …]`, which would leak the caller's environment into the snapshot.
use assert_cmd::Command;
fn help(args: &[&str]) -> String {
let output = Command::cargo_bin("smith")
.unwrap()
.args(args)
.env_remove("SMITH_PROVIDER")
.env_remove("SMITH_MODEL")
.env_remove("SMITH_BASE_URL")
.env_remove("CLICOLOR_FORCE")
.output()
.unwrap();
assert!(output.status.success(), "{output:?}");
assert!(output.stderr.is_empty(), "{output:?}");
String::from_utf8(output.stdout).unwrap()
}
#[test]
fn help_top_level() {
insta::assert_snapshot!(help(&["--help"]));
}
#[test]
fn help_eval() {
insta::assert_snapshot!(help(&["eval", "--help"]));
}