1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-09-07 20:02:17 +02:00

Test run_cmd

This commit is contained in:
mo8it 2024-05-01 18:08:18 +02:00
parent 32415e1e6c
commit d425dbe203

View File

@ -75,3 +75,19 @@ impl<'a> CargoCmd<'a> {
run_cmd(cmd, self.description, self.output)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_run_cmd() {
let mut cmd = Command::new("echo");
cmd.arg("Hello");
let mut output = Vec::with_capacity(8);
run_cmd(cmd, "echo …", &mut output).unwrap();
assert_eq!(output, b"Hello\n\n");
}
}