| Crates.io | power-assert |
| lib.rs | power-assert |
| version | 0.3.9 |
| created_at | 2015-08-30 14:17:00.030941+00 |
| updated_at | 2016-02-27 14:10:26.257767+00 |
| description | Power Assert in Rust. Provides better assertion message. |
| homepage | |
| repository | https://github.com/gifnksm/power-assert-rs |
| max_upload_size | |
| id | 2964 |
| size | 25,547 |
Power Assert in Rust. Provides better assertion message like this:
$ cargo run --example normal
Running `target/debug/examples/normal`
thread '<main>' panicked at 'assertion failed: bar.val == bar.foo.val
power_assert!(bar.val == bar.foo.val)
| | | | | |
| 3 | | | 2
| | | Foo { val: 2 }
| | Bar { val: 3, foo: Foo { val: 2 } }
| false
Bar { val: 3, foo: Foo { val: 2 } }
', examples/normal.rs:26
An unknown error occurred
To learn more, run the command again with --verbose.
Add this to your Cargo.toml:
[dependencies]
power-assert = "*"
and add this to your lib.rs or main.rs:
#![feature(plugin)]
#![plugin(power_assert)]
Now, you can use power_assert!() and power_assert_eq!().
If you want to override builtin assert!() and assert_eq!(), change your lib.rs or main.rs as follows.
#![feature(plugin)]
#![plugin(power_assert(override_builtins))]