1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//! **rvtest** — A Next Level Testing Library for Rust.
//!
//! `rvtest` extends Rust's built-in testing capabilities with:
//!
//! - **BDD-style specs** — organise tests with `describe` / `it` blocks,
//! nested hierarchies, lifecycle hooks (`before_all`, `after_all`,
//! `before_each`, `after_each`), tags, timeouts, and retries.
//! - **Property-based testing** — verify invariants over randomly generated
//! inputs, with automatic counterexample shrinking.
//! - **Parametrized tests** — run the same test logic against multiple
//! inputs without boilerplate.
//! - **Assertion macros** — `assert_eq!` with structural diffs, `assert_ok!`,
//! `assert_err!`, `assert_matches!`, `assert_delta!`.
//! - **Mocking utilities** — `Spy` (call-recording), `Stub` (fixed return),
//! `patch!` (scoped function replacement). No proc-macro required.
//! - **Snapshot testing** — file-based snapshot assertions with
//! `--update-all` auto-accept and `--review` interactive mode.
//! - **Architecture tests** — enforce module dependency rules
//! (`may_depend_on`, `may_not_depend_on`, `must_not_have_cycles`,
//! `public_api_doc_required`).
//! - **Output capture** — per-test stdout/stderr capture, shown only
//! on failure.
//! - **Rich reporting** — Pretty (human-readable with colour), TAP, JUnit
//! XML, JSON, Compact, and GitHub Actions annotations formats.
//! - **Code coverage** — measure line/function/region coverage via
//! pure-Rust `.profraw` parser (`cargo rvtest --coverage`). No external
//! LLVM tools required.
//! - **Configurable runner** — parallel execution, name and tag filtering,
//! fail-fast, configurable timeouts and retries.
//! - **Optional proc-macro API** — `#[describe]` / `#[it]` attribute macros
//! via the `macros` feature.
//!
//! # Usage inside `#[test]` (recommended)
//!
//! Rvtest is designed to be used inside standard `#[test]` functions.
//! Build a spec with [`describe`](spec::describe) and [`it`](spec::Spec::it), call
//! [`run`](spec::Spec::run), then verify with [`assert_all_pass`](core::TestSuite::assert_all_pass):
//!
//! ```ignore
//! use rvtest::spec::describe;
//!
//! #[test]
//! fn calculator_tests() {
//! describe("Calculator")
//! .it("adds two positive numbers", || {
//! assert_eq!(2 + 2, 4);
//! })
//! .it("subtracts", || {
//! assert_eq!(5 - 3, 2);
//! })
//! .tag("arithmetic")
//! .run()
//! .assert_all_pass();
//! }
//! ```
//!
//! Tags let you selectively run tests: `cargo rvtest --tag arithmetic`.
//! Other modifiers include `.timeout(dur)` and `.retries(n)`.
//!
//! # Property-based testing inside `#[test]`
//!
//! ```ignore
//! use rvtest::property::{check, any};
//!
//! #[test]
//! fn addition_is_commutative() {
//! check("commutativity", any::<i32>(), |a: &i32| {
//! let b: i32 = 42;
//! a + b == b + *a
//! });
//! }
//! ```
//!
//! # Parametrized tests inside `#[test]`
//!
//! ```ignore
//! use rvtest::param::parametrize;
//!
//! #[test]
//! fn addition_cases() {
//! for case in parametrize("add", [(1, 1, 2), (0, 0, 0), (-1, 1, 0)], |(a, b, exp)| {
//! assert_eq!(a + b, *exp);
//! }) {
//! assert!(case.status.is_passed(), "{} failed", case.name);
//! }
//! }
//! ```
//!
//! # CLI usage (`cargo rvtest`)
//!
//! The `cargo-rvtest` binary runs specs defined in your project and
//! produces formatted output. See `cargo rvtest --help`.
/// Re-export of the optional proc-macro crate.
///
/// Enabled via the `macros` feature:
///
/// ```toml
/// [dependencies]
/// rvtest = { version = "0.2", features = ["macros"] }
/// ```
///
/// Then use:
///
/// ```ignore
/// use rvtest::*;
/// ```
pub use ;
/// The `prelude` module re-exports the most commonly used types and
/// functions for convenience.