Hiya, I really like assert_cli, thanks for making such a useful crate!
Since I'm a fan of "automatically test everything, so I know when I break things", I have automated tests for my examples, and control them through arguments or stdin. For example:
externcrate assert_cli;#[test]fnexample_01_menu(){
assert_cli::Assert::command(&["cargo","run","--example","01_menu","--"]).with_args(&["--timeout","0"]).unwrap();}Now, because cargo run --example example_name always runs the example in the debug profile, to make sure I don't double compile when I'm testing my release profile build, I can do something like this:
externcrate assert_cli;#[test]fnexample_01_menu(){
assert_cli::Assert::command(&(example_command("01_menu"))).with_args(&["--timeout","0"]).unwrap();}fnexample_command(example_name:&'staticstr) -> Vec<&str>{letmut command = vec!["cargo","run"];if !cfg!(debug_assertions){
command.push("--release");}
command.extend(&["--example", example_name,"--"]);
command
}Since I would be replicating this functionality across a number of crates, I was wondering whether you'd like this to go in assert_cli (is it in line with what this crate is intended to cover), otherwise I can make an intermediate crate.
Edit: just noticed the conditional compilation for the profile is also mentioned in #86.
Hiya, I really like
assert_cli, thanks for making such a useful crate!Since I'm a fan of "automatically test everything, so I know when I break things", I have automated tests for my examples, and control them through arguments or
stdin. For example:Now, because
cargo run --example example_namealways runs the example in thedebugprofile, to make sure I don't double compile when I'm testing myreleaseprofile build, I can do something like this:Since I would be replicating this functionality across a number of crates, I was wondering whether you'd like this to go in
assert_cli(is it in line with what this crate is intended to cover), otherwise I can make an intermediate crate.Edit: just noticed the conditional compilation for the profile is also mentioned in #86.