Files
codex/codex-rs/cli/tests/version.rs
dank-openai a7c5f106cb version: share build-aware display version
Move the build git SHA display value into codex-utils-cli so codex --version, TUI headers, status lines, and status cards render the same version string.

(cherry picked from commit 9eeaac2f278e7babd768c1818aeb8f95e0022ebf)
(cherry picked from commit 97e4866de8026afdbe9f40c8fadf294d422b27df)
2026-05-02 10:49:47 -04:00

27 lines
625 B
Rust

use anyhow::Result;
use pretty_assertions::assert_eq;
use tempfile::TempDir;
#[test]
fn version_prints_build_git_sha() -> Result<()> {
let codex_home = TempDir::new()?;
let mut cmd = assert_cmd::Command::new(codex_utils_cargo_bin::cargo_bin("codex")?);
cmd.env("CODEX_HOME", codex_home.path());
let output = cmd
.arg("--version")
.assert()
.success()
.get_output()
.stdout
.clone();
let stdout = String::from_utf8(output)?;
assert_eq!(
stdout.trim(),
format!("codex-cli {}", codex_cli::CODEX_CLI_DISPLAY_VERSION)
);
Ok(())
}