use std::process::Command;
use assert_cmd::prelude::*;
use clap::{ValueEnum, crate_name, crate_version};
use clap_complete::Shell;
use color_eyre::Result;
#[test]
fn help_shows() -> Result<()> {
Command::cargo_bin("vmexec")?.arg("-h").assert().success();
Ok(())
}
#[test]
fn version_shows() -> Result<()> {
Command::cargo_bin("vmexec")?
.arg("-V")
.assert()
.success()
.stdout(format!("{} {}\n", crate_name!(), crate_version!()));
Ok(())
}
#[test]
fn print_completions() -> Result<()> {
for shell in Shell::value_variants() {
Command::cargo_bin("vmexec")?
.arg("completions")
.arg(shell.to_string())
.assert()
.success();
}
Ok(())
}
#[test]
fn print_completions_invalid_shell() -> Result<()> {
Command::cargo_bin("vmexec")?
.arg("completions")
.arg("fakeshell")
.assert()
.failure();
Ok(())
}