mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 07:20:30 +00:00
Test run_cmd
This commit is contained in:
parent
32415e1e6c
commit
d425dbe203
1 changed files with 16 additions and 0 deletions
16
src/cmd.rs
16
src/cmd.rs
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue