#![deny(missing_docs)]
#![deny(unsafe_code)]
#![deny(clippy::all)]
#![warn(clippy::pedantic)]
#[cfg(test)]
mod cli {
use assert_cmd::Command;
use std::error::Error;
use std::time::{Duration, Instant};
const MAIN: &str = env!("CARGO_PKG_NAME");
type TestResult = Result<(), Box<dyn Error>>;
#[test]
fn should_return_error_if_no_args_provided() -> TestResult {
Command::cargo_bin(MAIN)?.assert().failure();
Ok(())
}
#[test]
fn should_return_error_if_provided_argument_is_not_a_number() -> TestResult {
Command::cargo_bin(MAIN)?.arg("hello").assert().failure();
Ok(())
}
#[ignore]
#[test]
fn should_wait_for_about_six_seconds_if_argument_is_point_1() -> TestResult {
let now = Instant::now();
Command::cargo_bin(MAIN)?
.arg(".1")
.assert()
.success()
.stdout("time!\n");
assert!(now.elapsed() >= Duration::from_secs(6));
Ok(())
}
}