mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 00:00:03 +03:00
Test run_cmd
This commit is contained in:
parent
32415e1e6c
commit
d425dbe203
16
src/cmd.rs
16
src/cmd.rs
|
@ -75,3 +75,19 @@ impl<'a> CargoCmd<'a> {
|
||||||
run_cmd(cmd, self.description, self.output)
|
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