Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs ~ add customized assertion example
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#[allow(unused_imports)] | ||
use pretty_assertions; | ||
|
||
// note in docs/PR that "I don't think it's possible" to design a helper macro that simplifies the `assert_eq` generation | ||
// ... a generator macro "shadows" the std? `assert_eq!` macro at a lower scope level (terminology?) causing an error | ||
|
||
macro_rules! assert_eq { ($($arg:tt)+) => ({ | ||
pretty_assertions::with_config_assert_eq!( | ||
pretty_assertions::AssertConfig { style: pretty_assertions::Color::Yellow.normal(), auto_label: true, prefix_left: "<<=", prefix_right: "=>>", prefix: "<=>", ..Default::default() }, | ||
$($arg)+ | ||
) | ||
})} | ||
|
||
include!("standard_assertion.rs"); |