mirror of
https://codeberg.org/tyy/aspm
synced 2025-01-10 20:19:29 -07:00
34 lines
928 B
Rust
34 lines
928 B
Rust
|
use anyhow::Context;
|
||
|
use assert_cmd::prelude::*;
|
||
|
use predicates::prelude::*;
|
||
|
use tempfile::TempDir;
|
||
|
use std::process::Command;
|
||
|
|
||
|
#[test]
|
||
|
fn help_prints_correctly() -> Result<(), anyhow::Error> {
|
||
|
let tempdir = TempDir::new()?;
|
||
|
let datadir = tempdir.path().to_str().context("Tempdir path was not valid utf8")?;
|
||
|
|
||
|
Command::cargo_bin("aspm")?
|
||
|
.env("ASPM_DATA_DIR", datadir)
|
||
|
.arg("--help")
|
||
|
.assert()
|
||
|
.success()
|
||
|
.stdout(predicate::str::starts_with(env!("CARGO_PKG_DESCRIPTION")));
|
||
|
|
||
|
Command::cargo_bin("aspm")?
|
||
|
.env("ASPM_DATA_DIR", datadir)
|
||
|
.arg("-h")
|
||
|
.assert()
|
||
|
.success()
|
||
|
.stdout(predicate::str::starts_with(env!("CARGO_PKG_DESCRIPTION")));
|
||
|
|
||
|
Command::cargo_bin("aspm")?
|
||
|
.env("ASPM_DATA_DIR", datadir)
|
||
|
.assert()
|
||
|
.code(2)
|
||
|
.stderr(predicate::str::starts_with(env!("CARGO_PKG_DESCRIPTION")));
|
||
|
|
||
|
Ok(())
|
||
|
}
|