# Deprecated — use [assert2][]
Use [assert2][] instead of this crate. `assertify!` can be replaced by the
more capable [`assert2::assert!`][] everywhere, and `testify!` can implemented
with a short macro:
```rust
macro_rules! testify {
($name:ident, $($test:tt)+) => {
#[test]
fn $name() {
::assert2::assert!($($test)+);
}
};
}
```
### `assertify!(expr)`
**Deprecated**: use [`assert2::assert!`][].
Generates an assertion for `expr` with a friendly failure message. If `expr` is
a binary expression, the actual value should be on the left and the expected
value should be on the right.
```rust
#[test]
fn simple_eq() {
assertify!(1 + 2 == 0);
}
```
```
---- tests::simple_eq stdout ----
thread 'tests::simple_eq' panicked at 'failed: 1 + 2 == 0
actual: 3
expected: == 0
', src/lib.rs:98:9
```
This is a major improvement over the message generated by `assert_eq!`, since
the failure message shows what the failed expression was.
```rust
#[test]
fn simple_eq_traditional() {
assert_eq!(1 + 2, 0);
}
```
```
---- tests::simple_eq_traditional stdout ----
thread 'tests::simple_eq_traditional' panicked at 'assertion failed: `(left == right)`
left: `3`,
right: `0`', src/lib.rs:103:9
```
### `testify!(name, expr)`
**Deprecated**: Use the following:
```rust
macro_rules! testify {
($name:ident, $($test:tt)+) => {
#[test]
fn $name() {
::assert2::assert!($($test)+);
}
};
}
```
Generates a test function named `name` that asserts that `expr` is true.
```rust
testify!(concat_literals, concat("a", "b") == "ab");
```
Again, the failure messages are easy to understand:
```
---- tests::concat_literals stdout ----
thread 'tests::concat_literals' panicked at 'failed: concat("a", "b") == "aX"
actual: "ab"
expected: == "aX"
', src/lib.rs:106:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
## Compatibility
This requires at least Rust version 1.45 (released in July 2020).
## License
This project dual-licensed under the Apache 2 and MIT licenses. You may choose
to use either.
* [Apache License, Version 2.0](LICENSE-APACHE)
* [MIT license](LICENSE-MIT)
### Contributions
Unless you explicitly state otherwise, any contribution you submit as defined
in the Apache 2.0 license shall be dual licensed as above, without any
additional terms or conditions.
[assert2]: https://crates.io/crates/assert2
[`assert2::assert!`]: https://docs.rs/assert2/0.3.7/assert2/macro.assert.html