Tests: Check stderr is empty in test_flags

For each test_flag test using the build_command helper method, check
that stderr is empty
This commit is contained in:
andy.boot
2022-08-19 10:32:05 +01:00
parent 2713445ad0
commit 34ba99af2a

View File

@@ -9,11 +9,15 @@ use std::str;
*/
fn build_command<T: AsRef<OsStr>>(command_args: Vec<T>) -> String {
let mut a = &mut Command::cargo_bin("dust").unwrap();
let mut cmd = &mut Command::cargo_bin("dust").unwrap();
for p in command_args {
a = a.arg(p);
cmd = cmd.arg(p);
}
str::from_utf8(&a.unwrap().stdout).unwrap().into()
let finished = &cmd.unwrap();
let stderr = str::from_utf8(&finished.stderr).unwrap();
assert_eq!(stderr, "");
str::from_utf8(&finished.stdout).unwrap().into()
}
// We can at least test the file names are there