Module assert_cmd::cargo [−][src]
Simplify running bins in a Cargo project.
CommandCargoExt is an extension trait for Command to easily launch a crate's
binaries.
In addition, the underlying functions for looking up the crate's binaries are exposed to allow for optimizations, if needed.
Examples
Simple case:
use assert_cmd::prelude::*; use std::process::Command; Command::main_binary() .unwrap() .unwrap();
Caching the binary's location:
use assert_cmd::prelude::*; use std::process::Command; let bin_under_test = assert_cmd::cargo::main_binary_path().unwrap(); Command::new(&bin_under_test) .unwrap();
Tip: Use lazy_static to cache bin_under_test across test functions.
Structs
| CargoError |
Error when finding crate binary. |
Traits
| CommandCargoExt |
Create a |
Functions
| cargo_bin_path |
Get the path to the specified binary of the current crate. |
| cargo_example_path |
Get the path to the specified example of the current crate. |
| main_binary_path |
Get the path to the crate's main binary. |