Skip to content

Commit

Permalink
Fix message output
Browse files Browse the repository at this point in the history
  • Loading branch information
joelparkerhenderson committed Nov 18, 2024
1 parent 28b4d23 commit bd437f5
Show file tree
Hide file tree
Showing 462 changed files with 614 additions and 606 deletions.
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Assertables: Rust crate of assert macros for testing

Assertables is a Rust crate that provides many assert macros
to improve your compile-time tests and run-time reliability.
Assertables is a Rust crate of assert macros to improve you compile-time testing and run-time reliability.

* Crate: [https://crates.io/crates/assertables](https://crates.io/crates/assertables)
* Docs: [https://docs.rs/assertables/](https://docs.rs/assertables/)
* Repo: [https://github.com/sixarm/assertables-rust-crate/](https://github.com/sixarm/assertables-rust-crate/)
* Contact: [[email protected]](mailto:[email protected])
* Tagging: #assert #assertion #rust #testing #macros #tdd #testdrivendevelopment

## Introduction

Expand All @@ -17,13 +17,17 @@ that can help you develop, test, and debug.
[assert_lt](https://docs.rs/assertables/9.4.0/assertables/assert_lt),
[assert_gt](https://docs.rs/assertables/9.4.0/assertables/assert_gt),
[](https://docs.rs/assertables)
* Test groups with
[assert_all](https://docs.rs/assertables/9.4.0/assertables/assert_all),
[assert_any](https://docs.rs/assertables/9.4.0/assertables/assert_any),
[](https://docs.rs/assertables)
* Test results with
[assert_ok](https://docs.rs/assertables/9.4.0/assertables/assert_ok),
[assert_err](https://docs.rs/assertables/9.4.0/assertables/assert_err),
[](https://docs.rs/assertables)
* Test groups with
[assert_all](https://docs.rs/assertables/9.4.0/assertables/assert_all),
[assert_any](https://docs.rs/assertables/9.4.0/assertables/assert_any),
* Test options with
[assert_some](https://docs.rs/assertables/9.4.0/assertables/assert_some),
[assert_none](https://docs.rs/assertables/9.4.0/assertables/assert_none),
[](https://docs.rs/assertables)
* Test matching with
[assert_matches](https://docs.rs/assertables/9.4.0/assertables/assert_matches),
Expand Down Expand Up @@ -51,12 +55,6 @@ Benefits:
* You can handle more corner cases without needing to write custom code.
* You can troubleshoot faster because error messages show more detail.

Features:

* Easy to use: everything is well-documented with runnable examples.
* Zero overhead: if you don't use a macro, then it's not compiled.
* Multiple forms: for panic, debug, result return, success return.

Learning:
[FAQ](https://github.com/SixArm/assertables-rust-crate/tree/main/help/faq),
[docs](https://docs.rs/assertables/),
Expand Down Expand Up @@ -108,12 +106,12 @@ assert_any!(a.into_iter(), |i: i32| i > 2);

Values:

* [`assert_eq!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_eq) ≈ a = b
* [`assert_ne!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_ne) ≈ a ≠ b
* [`assert_lt!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_lt) ≈ a < b
* [`assert_le!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_le) ≈ a ≤ b
* [`assert_gt!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_gt) ≈ a > b
* [`assert_ge!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_ge) ≈ a ≥ b
* [`assert_eq!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_eq) ≈ a = b ≈ equal to
* [`assert_ne!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_ne) ≈ a ≠ b ≈ not equal to
* [`assert_lt!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_lt) ≈ a < b ≈ less than
* [`assert_le!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_le) ≈ a ≤ b ≈ less than or equal to
* [`assert_gt!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_gt) ≈ a > b ≈ greater than
* [`assert_ge!(a, b)`](https://docs.rs/assertables/9.4.0/assertables/assert_ge) ≈ a ≥ b ≈ greater than or equal to

Approximations:

Expand Down Expand Up @@ -143,19 +141,19 @@ Results:

* [`assert_ok!(a)`](https://docs.rs/assertables/9.4.0/assertables/assert_ok) ≈ a is Ok
* [`assert_err!(a)`](https://docs.rs/assertables/9.4.0/assertables/assert_err) ≈ a is Err
* [`assert_ok_eq_x!(a, x)`](https://docs.rs/assertables/9.4.0/assertables/assert_ok/assert_ok_eq_x) ≈ a is Ok unwrap = x
* [`assert_ok_eq_x!(a, x)`](https://docs.rs/assertables/9.4.0/assertables/assert_ok/assert_ok_eq_x) ≈ a is Ok unwrap = x

Options:

* [`assert_some!(a)`](https://docs.rs/assertables/9.4.0/assertables/assert_some) ≈ a is Some
* [`assert_none!(a)`](https://docs.rs/assertables/9.4.0/assertables/assert_none) ≈ a is None
* [`assert_some_eq_x!(a, x)`](https://docs.rs/assertables/9.4.0/assertables/assert_some/assert_some_eq_x) ≈ a is Some unwrap = x
* [`assert_some_eq_x!(a, x)`](https://docs.rs/assertables/9.4.0/assertables/assert_some/assert_some_eq_x) ≈ a is Some unwrap = x

Polls:

* [`assert_ready!(a)`](https://docs.rs/assertables/9.4.0/assertables/assert_ready) ≈ a is Ready
* [`assert_pending!(a)`](https://docs.rs/assertables/9.4.0/assertables/assert_pending) ≈ a is Pending
* [`assert_ready_eq_x!(a, x)`](https://docs.rs/assertables/9.4.0/assertables/assert_ready/assert_ready_eq_x) ≈ a is Ready unwrap = x
* [`assert_ready_eq_x!(a, x)`](https://docs.rs/assertables/9.4.0/assertables/assert_ready/assert_ready_eq_x) ≈ a is Ready unwrap = x

Readers:

Expand Down
36 changes: 20 additions & 16 deletions doc/lib/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Assertables: Rust crate of assert macros for testing"><title>lib - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-492a78a4a87dcc01.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.82.0 (f6e511eec 2024-10-15)" data-channel="1.82.0" data-search-js="search-a99f1315e7cc5121.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-921df33f47b8780c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-3b12f09e550e0385.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../lib/index.html">lib</a></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li></ul></section></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <a class="mod" href="#">lib</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/lib/lib.rs.html#1-301">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="assertables-rust-crate-of-assert-macros-for-testing"><a class="doc-anchor" href="#assertables-rust-crate-of-assert-macros-for-testing">§</a>Assertables: Rust crate of assert macros for testing</h2>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Assertables: Rust crate of assert macros for testing"><title>lib - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-492a78a4a87dcc01.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="lib" data-themes="" data-resource-suffix="" data-rustdoc-version="1.82.0 (f6e511eec 2024-10-15)" data-channel="1.82.0" data-search-js="search-a99f1315e7cc5121.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../crates.js"></script><script defer src="../static.files/main-921df33f47b8780c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-3b12f09e550e0385.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../lib/index.html">lib</a></h2></div><div class="sidebar-elems"><ul class="block"><li><a id="all-types" href="all.html">All Items</a></li></ul><section><ul class="block"><li><a href="#modules">Modules</a></li><li><a href="#macros">Macros</a></li></ul></section></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Crate <a class="mod" href="#">lib</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../src/lib/lib.rs.html#1-305">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="assertables-rust-crate-of-assert-macros-for-testing"><a class="doc-anchor" href="#assertables-rust-crate-of-assert-macros-for-testing">§</a>Assertables: Rust crate of assert macros for testing</h2>
<p>Assertables is a Rust crate that provides many assert macros
to improve your compile-time tests and run-time reliability.</p>
<ul>
Expand All @@ -14,15 +14,19 @@ <h3 id="introduction"><a class="doc-anchor" href="#introduction">§</a>Introduct
<li>Test values with
<a href="assert_lt/index.html" title="mod lib::assert_lt">assert_lt</a>,
<a href="assert_gt/index.html" title="mod lib::assert_gt">assert_gt</a>,
<a href="assert_approx/index.html" title="mod lib::assert_approx"></a></li>
<li>Test results with
<a href="assert_ok/index.html" title="mod lib::assert_ok">assert_ok</a>,
<a href="assert_err/index.html" title="mod lib::assert_err">assert_err</a>,
<a href="assert_ok/assert_ok_eq_x/index.html" title="mod lib::assert_ok::assert_ok_eq_x"></a></li>
<a href="https://docs.rs/assertables"></a></li>
<li>Test groups with
<a href="assert_all/index.html" title="mod lib::assert_all">assert_all</a>,
<a href="assert_any/index.html" title="mod lib::assert_any">assert_any</a>,
<a href="assert_iter/index.html" title="mod lib::assert_iter"></a></li>
<a href="https://docs.rs/assertables"></a></li>
<li>Test results with
<a href="assert_ok/index.html" title="mod lib::assert_ok">assert_ok</a>,
<a href="assert_err/index.html" title="mod lib::assert_err">assert_err</a>,
<a href="https://docs.rs/assertables"></a></li>
<li>Test options with
<a href="assert_some/index.html" title="mod lib::assert_some">assert_some</a>,
<a href="assert_none/index.html" title="mod lib::assert_none">assert_none</a>,
<a href="https://docs.rs/assertables"></a></li>
<li>Test matching with
<a href="assert_matches/index.html" title="mod lib::assert_matches">assert_matches</a>,
<a href="assert_is_match/index.html" title="mod lib::assert_is_match">assert_is_match</a>,
Expand Down Expand Up @@ -90,12 +94,12 @@ <h3 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h3>
<h3 id="highlights"><a class="doc-anchor" href="#highlights">§</a>Highlights</h3>
<p>Values:</p>
<ul>
<li><a href="assert_eq/index.html" title="mod lib::assert_eq"><code>assert_eq!(a, b)</code></a> ≈ a = b</li>
<li><a href="assert_ne/index.html" title="mod lib::assert_ne"><code>assert_ne!(a, b)</code></a> ≈ a ≠ b</li>
<li><a href="assert_lt/index.html" title="mod lib::assert_lt"><code>assert_lt!(a, b)</code></a> ≈ a &lt; b</li>
<li><a href="assert_le/index.html" title="mod lib::assert_le"><code>assert_le!(a, b)</code></a> ≈ a ≤ b</li>
<li><a href="assert_gt/index.html" title="mod lib::assert_gt"><code>assert_gt!(a, b)</code></a> ≈ a &gt; b</li>
<li><a href="assert_ge/index.html" title="mod lib::assert_ge"><code>assert_ge!(a, b)</code></a> ≈ a ≥ b</li>
<li><a href="assert_eq/index.html" title="mod lib::assert_eq"><code>assert_eq!(a, b)</code></a> ≈ a = b ≈ equal to</li>
<li><a href="assert_ne/index.html" title="mod lib::assert_ne"><code>assert_ne!(a, b)</code></a> ≈ a ≠ b ≈ not equal to</li>
<li><a href="assert_lt/index.html" title="mod lib::assert_lt"><code>assert_lt!(a, b)</code></a> ≈ a &lt; b ≈ less than</li>
<li><a href="assert_le/index.html" title="mod lib::assert_le"><code>assert_le!(a, b)</code></a> ≈ a ≤ b ≈ less than or equal to</li>
<li><a href="assert_gt/index.html" title="mod lib::assert_gt"><code>assert_gt!(a, b)</code></a> ≈ a &gt; b ≈ greater than</li>
<li><a href="assert_ge/index.html" title="mod lib::assert_ge"><code>assert_ge!(a, b)</code></a> ≈ a ≥ b ≈ greater than or equal to</li>
</ul>
<p>Nearness:</p>
<ul>
Expand Down Expand Up @@ -125,19 +129,19 @@ <h3 id="highlights"><a class="doc-anchor" href="#highlights">§</a>Highlights</h
<ul>
<li><a href="assert_ok/index.html" title="mod lib::assert_ok"><code>assert_ok!(a)</code></a> ≈ a is Ok</li>
<li><a href="assert_err/index.html" title="mod lib::assert_err"><code>assert_err!(a)</code></a> ≈ a is Err</li>
<li><a href="assert_ok/assert_ok_eq_x/index.html" title="mod lib::assert_ok::assert_ok_eq_x"><code>assert_ok_eq_x!(a, x)</code></a> ≈ a is Ok unwrap = x</li>
<li><a href="assert_ok/assert_ok_eq_x/index.html" title="mod lib::assert_ok::assert_ok_eq_x"><code>assert_ok_eq_x!(a, x)</code></a> ≈ a is Ok unwrap = x</li>
</ul>
<p>Options:</p>
<ul>
<li><a href="assert_some/index.html" title="mod lib::assert_some"><code>assert_some!(a)</code></a> ≈ a is Some</li>
<li><a href="assert_none/index.html" title="mod lib::assert_none"><code>assert_none!(a)</code></a> ≈ a is None</li>
<li><a href="assert_some/assert_some_eq_x/index.html" title="mod lib::assert_some::assert_some_eq_x"><code>assert_some_eq_x!(a, x)</code></a> ≈ a is Some unwrap = x</li>
<li><a href="assert_some/assert_some_eq_x/index.html" title="mod lib::assert_some::assert_some_eq_x"><code>assert_some_eq_x!(a, x)</code></a> ≈ a is Some unwrap = x</li>
</ul>
<p>Polls:</p>
<ul>
<li><a href="assert_ready/index.html" title="mod lib::assert_ready"><code>assert_ready!(a)</code></a> ≈ a is Ready</li>
<li><a href="assert_pending/index.html" title="mod lib::assert_pending"><code>assert_pending!(a)</code></a> ≈ a is Pending</li>
<li><a href="assert_ready/assert_ready_eq_x/index.html" title="mod lib::assert_ready::assert_ready_eq_x"><code>assert_ready_eq_x!(a, x)</code></a> ≈ a is Ready unwrap = x</li>
<li><a href="assert_ready/assert_ready_eq_x/index.html" title="mod lib::assert_ready::assert_ready_eq_x"><code>assert_ready_eq_x!(a, x)</code></a> ≈ a is Ready unwrap = x</li>
</ul>
<p>Collections:</p>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion doc/src/lib/assert_abs_diff/assert_abs_diff_eq.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@
(<span class="macro-nonterminal">$a</span>:expr, <span class="macro-nonterminal">$b</span>:expr, <span class="macro-nonterminal">$delta</span>:expr, $(<span class="macro-nonterminal">$message</span>:tt)+) =&gt; {{
<span class="kw">match </span><span class="macro-nonterminal">$</span><span class="macro">crate::assert_abs_diff_eq_as_result!</span>(<span class="macro-nonterminal">$a</span>, <span class="macro-nonterminal">$b</span>, <span class="macro-nonterminal">$delta</span>) {
<span class="prelude-val">Ok</span>(x) =&gt; x,
<span class="prelude-val">Err</span>(_err) =&gt; <span class="macro">panic!</span>(<span class="string">"{}"</span>, $(<span class="macro-nonterminal">$message</span>)+),
<span class="prelude-val">Err</span>(err) =&gt; <span class="macro">panic!</span>(<span class="string">"{}\n{}"</span>, <span class="macro">format_args!</span>($(<span class="macro-nonterminal">$message</span>)+), err),
}
}};
}
Expand Down
2 changes: 1 addition & 1 deletion doc/src/lib/assert_abs_diff/assert_abs_diff_ge.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@
(<span class="macro-nonterminal">$a</span>:expr, <span class="macro-nonterminal">$b</span>:expr, <span class="macro-nonterminal">$delta</span>:expr, $(<span class="macro-nonterminal">$message</span>:tt)+) =&gt; {{
<span class="kw">match </span><span class="macro-nonterminal">$</span><span class="macro">crate::assert_abs_diff_ge_as_result!</span>(<span class="macro-nonterminal">$a</span>, <span class="macro-nonterminal">$b</span>, <span class="macro-nonterminal">$delta</span>) {
<span class="prelude-val">Ok</span>(x) =&gt; x,
<span class="prelude-val">Err</span>(_err) =&gt; <span class="macro">panic!</span>(<span class="string">"{}"</span>, $(<span class="macro-nonterminal">$message</span>)+),
<span class="prelude-val">Err</span>(err) =&gt; <span class="macro">panic!</span>(<span class="string">"{}\n{}"</span>, <span class="macro">format_args!</span>($(<span class="macro-nonterminal">$message</span>)+), err),
}
}};
}
Expand Down
2 changes: 1 addition & 1 deletion doc/src/lib/assert_abs_diff/assert_abs_diff_gt.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@
(<span class="macro-nonterminal">$a</span>:expr, <span class="macro-nonterminal">$b</span>:expr, <span class="macro-nonterminal">$delta</span>:expr, $(<span class="macro-nonterminal">$message</span>:tt)+) =&gt; {{
<span class="kw">match </span><span class="macro-nonterminal">$</span><span class="macro">crate::assert_abs_diff_gt_as_result!</span>(<span class="macro-nonterminal">$a</span>, <span class="macro-nonterminal">$b</span>, <span class="macro-nonterminal">$delta</span>) {
<span class="prelude-val">Ok</span>(x) =&gt; x,
<span class="prelude-val">Err</span>(_err) =&gt; <span class="macro">panic!</span>(<span class="string">"{}"</span>, $(<span class="macro-nonterminal">$message</span>)+),
<span class="prelude-val">Err</span>(err) =&gt; <span class="macro">panic!</span>(<span class="string">"{}\n{}"</span>, <span class="macro">format_args!</span>($(<span class="macro-nonterminal">$message</span>)+), err),
}
}};
}
Expand Down
Loading

0 comments on commit bd437f5

Please sign in to comment.