From c5358e3ef23b3c2f3a6c9789432af22f185a80b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Mon, 27 Jan 2020 22:41:26 -0700 Subject: Cleanup the test program --- tests/cli.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tests/cli.rs b/tests/cli.rs index d03e449..4ddc675 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -1,10 +1,7 @@ -use std::process::Command; // Run programs -use assert_cmd::prelude::*; // Add methods on commands -use predicates::prelude::*; // Used for writing assertions -use assert_cmd::assert::Assert; +use assert_cmd::prelude::OutputAssertExt; // Add methods on commands +use predicates::prelude::{predicate, PredicateBooleanExt}; // Used for writing assertions #[cfg(unix)] use std::os::unix::process::ExitStatusExt; -use std::process::ExitStatus; pub trait Success2 { // Our own function with better reporting of errors @@ -12,16 +9,16 @@ pub trait Success2 { } #[cfg(unix)] -fn get_signal(status: ExitStatus) -> Option { +fn get_signal(status: std::process::ExitStatus) -> Option { status.signal() } #[cfg(not(unix))] -fn get_signal(_status: ExitStatus) -> Option { +fn get_signal(_status: std::process::ExitStatus) -> Option { None } -impl Success2 for Assert { +impl Success2 for assert_cmd::assert::Assert { fn success2(self) -> Self { if !self.get_output().status.success() { let output = self.get_output(); @@ -43,11 +40,11 @@ impl Success2 for Assert { } } -fn fpm_bin() -> Command { +fn fpm_bin() -> std::process::Command { let mut fpm_bin_relative: std::path::PathBuf = ["target", "debug", "fpm"].iter().collect(); fpm_bin_relative.set_extension(std::env::consts::EXE_EXTENSION); let fpm_bin_absolute = std::fs::canonicalize(fpm_bin_relative).unwrap(); - Command::new(fpm_bin_absolute.to_str().unwrap()) + std::process::Command::new(fpm_bin_absolute.to_str().unwrap()) } #[test] -- cgit v1.2.3