28 lines
903 B
Rust
28 lines
903 B
Rust
// filename: tests/integration.rs
|
|
|
|
mod integration {
|
|
use regex::Regex;
|
|
use std::process::Command;
|
|
|
|
#[test]
|
|
fn calling_carman_without_args_returns_result() {
|
|
let output = Command::new("./target/debug/carman")
|
|
.output()
|
|
.expect("failed to execute process");
|
|
let re = Regex::new(r"^Hello").unwrap();
|
|
assert!(re.is_match(&String::from_utf8_lossy(&output.stdout)));
|
|
}
|
|
|
|
#[test]
|
|
fn calling_carman_with_help_returns_usage() {
|
|
let output = Command::new("./target/debug/carman")
|
|
.arg("--help")
|
|
.output()
|
|
.expect("failed to execute process");
|
|
let re = Regex::new(r"^carman").unwrap();
|
|
assert!(re.is_match(&String::from_utf8_lossy(&output.stdout)));
|
|
let re = Regex::new(r"--help").unwrap();
|
|
assert!(re.is_match(&String::from_utf8_lossy(&output.stdout)));
|
|
}
|
|
}
|