Skip to content

Lindenk/assert_cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assert CLI

Test CLI Applications.

Currently, this crate only includes basic functionality to check the output of a child process is as expected.

Build Status Coverage Status

Documentation

Install

Just add it to your Cargo.toml:

[dependencies]
assert_cli = "0.1.0"

Example

Here's a trivial example:

extern crate assert_cli;
assert_cli::assert_cli_output("echo", &["42"], "42").unwrap();

Or if you'd rather use the macro:

#[macro_use] extern crate assert_cli;
assert_cli!("echo", &["42"] => Success, "42").unwrap();
assert_cli!("black-box", &["--special"] => Error 42, "error no 42\n").unwrap()

And here is one that will fail:

extern crate assert_cli;
assert_cli::assert_cli_output("echo", &["42"], "1337").unwrap();

this will show a nice, colorful diff in your terminal, like this:

-1337
+42

If you'd prefer to not check the output:

#[macro_use] extern crate assert_cli;
assert_cli::assert_cli("echo", &["42"]).unwrap();
assert_cli!("echo", &["42"] => Success).unwrap();

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Test CLI Applications in Rust.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%