Skip to content

Commit

Permalink
Add shorter macro names for Result, Option, Poll
Browse files Browse the repository at this point in the history
  • Loading branch information
joelparkerhenderson committed Sep 18, 2024
1 parent 41bf810 commit cd59bcc
Show file tree
Hide file tree
Showing 335 changed files with 10,561 additions and 448 deletions.
18 changes: 7 additions & 11 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@ Changes highlights for recent major versions.

## Version 8.x

8.6: Add `assert_poll_ready_eq`, `assert_poll_ready_ne`
* Add Result macros: `assert_ok`, `assert_err`, et al.

* Add Option macros: `assert_some`, `assert_none`, et al.

8.5: Add `assert_option_some_eq`, `assert_option_some_ne`
* Add Poll macros: `assert_ready`, `assert_pending`, et al.

8.4: Add `assert_result_ok_eq`, `assert_result_ok_ne`

8.3: Add `assert_poll_ready`, `assert_poll_pending`.

8.2: Add `assert_infix`.

8.1: Add `assert_result_ok`, `assert_result_err`, `assert_option_some`, `assert_option_none`.

8.0: Add `assert_fs_read_to_string_*`, `assert_io_read_to_string_*`. Breaking change: migrate from `assert_read_to_string_*`. to `assert_io_read_to_string_*`.
* Add read macros: `assert_fs_read_to_string_*`, `assert_io_read_to_string_*`, et al.

* Breaking change: migrate from `assert_read_to_string_*`. to `assert_io_read_to_string_*`.


## Version 7.x
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "assertables"
version = "8.6.0"
version = "8.7.0"
authors = ["Joel Parker Henderson <[email protected]>"]
edition = "2021"
description = "Assertables: Rust crate of macros `assert…!` for better tests, quality assurance, debug testing, and runtime reliability."
Expand Down
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ compile-time tests and run-time reliability.
The Rust programming language provides assert macros to test code:

* [`assert!()`](https://doc.rust-lang.org/std/macro.assert.html)
* [`assert_eq!(a, b)`](https://doc.rust-lang.org/std/macro.assert_eq.html)
* [`assert_ne!(a, b)`]((https://doc.rust-lang.org/std/macro.assert_ne.html)
* [`assert_eq!(a, b)`](https://doc.rust-lang.org/std/macro.assert_eq.html) `// equal`
* [`assert_ne!(a, b)`](https://doc.rust-lang.org/std/macro.assert_ne.html) `// not equal`

The assertables crate provides many more, so you can write smarter tests.

For values:

* [`assert_lt!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_lt.html) // less than
* [`assert_le!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_le.html) // less than or equal to
* [`assert_gt!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_gt.html) // greater than
* [`assert_ge!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_ge.html) // greater than or equal to
* [`assert_lt!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_lt.html) `// less than`
* [`assert_le!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_le.html) `// less than or equal`
* [`assert_gt!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_gt.html) `// greater than`
* [`assert_ge!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_ge.html) `// greater than or equal`

For strings:

Expand All @@ -46,26 +46,26 @@ For numbers:
* [`assert_in_delta!(a, b, delta)`](https://docs.rs/assertables/latest/assertables/macro.assert_in_delta.html)
* [`assert_in_epsilon!(a, b, epsilon)`](https://docs.rs/assertables/latest/assertables/macro.assert_in_epsilon.html)

For results:
For Result:

* [`assert_result_ok!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_result_ok.html)
* [`assert_result_ok_eq!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_result_ok_eq.html)
* [`assert_result_ok_ne!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_result_ok_ne.html)
* [`assert_result_err!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_result_err.html)
* [`assert_ok!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_ok.html)
* [`assert_ok_eq!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_ok_eq.html)
* [`assert_ok_ne!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_ok_ne.html)
* [`assert_err!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_err.html)

For options:
For Option:

* [`assert_option_some!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_option_some.html)
* [`assert_option_some_eq!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_option_some_eq.html)
* [`assert_option_some_ne!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_option_some_ne.html)
* [`assert_option_none!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_option_none.html)
* [`assert_some!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_some.html)
* [`assert_some_eq!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_some_eq.html)
* [`assert_some_ne!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_some_ne.html)
* [`assert_none!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_none.html)

For polls:
For Poll:

* [`assert_poll_ready!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_poll_ready.html)
* [`assert_poll_ready_eq!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_poll_ready_eq.html)
* [`assert_poll_ready_ne!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_poll_ready_ne.html)
* [`assert_poll_pending!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_poll_pending.html)
* [`assert_ready!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_ready.html)
* [`assert_ready_eq!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_ready_eq.html)
* [`assert_ready_ne!(a, b)`](https://docs.rs/assertables/latest/assertables/macro.assert_ready_ne.html)
* [`assert_pending!(a)`](https://docs.rs/assertables/latest/assertables/macro.assert_pending.html)

For collections such as arrays, vectors, maps, sets:

Expand Down Expand Up @@ -182,8 +182,8 @@ Examples:
## Tracking

* Package: assertables-rust-crate
* Version: 8.6.0
* Version: 8.7.0
* Created: 2021-03-30T15:47:49Z
* Updated: 2024-09-18T03:02:31Z
* Updated: 2024-09-18T14:51:06Z
* License: MIT or Apache-2.0 or GPL-2.0 or GPL-3.0 or contact us for more
* Contact: Joel Parker Henderson ([email protected])
2 changes: 1 addition & 1 deletion doc/lib/all.html

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions doc/lib/assert_err/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!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="Assert expression is Err(_)."><title>lib::assert_err - 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-c5d6553a23f1e5a6.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.81.0 (eeb90cda1 2024-09-04)" data-channel="1.81.0" data-search-js="search-d234aafac6c221dd.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-d2fab2bf619172d3.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-df360f571f6edeae.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"><!--[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><h2 class="location"><a href="#">Module assert_err</a></h2><div class="sidebar-elems"><h2><a href="../index.html">In crate lib</a></h2></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>Module <a href="../index.html">lib</a>::<wbr><a class="mod" href="#">assert_err</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/assert_err.rs.html#1-179">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"><p>Assert expression is Err(_).</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a: <span class="prelude-ty">Result</span>&lt;(), i8&gt; = <span class="prelude-val">Err</span>(<span class="number">1</span>);
<span class="macro">assert_err!</span>(a);</code></pre></div>
<h2 id="module-macros"><a class="doc-anchor" href="#module-macros">§</a>Module macros</h2>
<ul>
<li><a href="../macro.assert_err.html" title="macro lib::assert_err"><code>assert_err</code></a></li>
<li><a href="../macro.assert_err_as_result.html" title="macro lib::assert_err_as_result"><code>assert_err_as_result</code></a></li>
<li><a href="../macro.debug_assert_err.html" title="macro lib::debug_assert_err"><code>debug_assert_err</code></a></li>
</ul>
</div></details></section></div></main></body></html>
1 change: 1 addition & 0 deletions doc/lib/assert_err/sidebar-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {};
11 changes: 11 additions & 0 deletions doc/lib/assert_none/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!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="Assert expression is None."><title>lib::assert_none - 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-c5d6553a23f1e5a6.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.81.0 (eeb90cda1 2024-09-04)" data-channel="1.81.0" data-search-js="search-d234aafac6c221dd.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-d2fab2bf619172d3.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-df360f571f6edeae.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"><!--[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><h2 class="location"><a href="#">Module assert_none</a></h2><div class="sidebar-elems"><h2><a href="../index.html">In crate lib</a></h2></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>Module <a href="../index.html">lib</a>::<wbr><a class="mod" href="#">assert_none</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/assert_none.rs.html#1-179">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"><p>Assert expression is None.</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a: <span class="prelude-ty">Option</span>&lt;i8&gt; = Option::None;
<span class="macro">assert_none!</span>(a);</code></pre></div>
<h2 id="module-macros"><a class="doc-anchor" href="#module-macros">§</a>Module macros</h2>
<ul>
<li><a href="../macro.assert_none.html" title="macro lib::assert_none"><code>assert_none</code></a></li>
<li><a href="../macro.assert_none_as_result.html" title="macro lib::assert_none_as_result"><code>assert_none_as_result</code></a></li>
<li><a href="../macro.debug_assert_none.html" title="macro lib::debug_assert_none"><code>debug_assert_none</code></a></li>
</ul>
</div></details></section></div></main></body></html>
1 change: 1 addition & 0 deletions doc/lib/assert_none/sidebar-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {};
11 changes: 11 additions & 0 deletions doc/lib/assert_ok/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!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="Assert expression is Ok(_)."><title>lib::assert_ok - 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-c5d6553a23f1e5a6.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.81.0 (eeb90cda1 2024-09-04)" data-channel="1.81.0" data-search-js="search-d234aafac6c221dd.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-d2fab2bf619172d3.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-df360f571f6edeae.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"><!--[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><h2 class="location"><a href="#">Module assert_ok</a></h2><div class="sidebar-elems"><h2><a href="../index.html">In crate lib</a></h2></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>Module <a href="../index.html">lib</a>::<wbr><a class="mod" href="#">assert_ok</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/assert_ok.rs.html#1-179">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"><p>Assert expression is Ok(_).</p>
<h2 id="example"><a class="doc-anchor" href="#example">§</a>Example</h2>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>a: <span class="prelude-ty">Result</span>&lt;(), i8&gt; = <span class="prelude-val">Ok</span>(());
<span class="macro">assert_ok!</span>(a);</code></pre></div>
<h2 id="module-macros"><a class="doc-anchor" href="#module-macros">§</a>Module macros</h2>
<ul>
<li><a href="../macro.assert_ok.html" title="macro lib::assert_ok"><code>assert_ok</code></a></li>
<li><a href="../macro.assert_ok_as_result.html" title="macro lib::assert_ok_as_result"><code>assert_ok_as_result</code></a></li>
<li><a href="../macro.debug_assert_ok.html" title="macro lib::debug_assert_ok"><code>debug_assert_ok</code></a></li>
</ul>
</div></details></section></div></main></body></html>
1 change: 1 addition & 0 deletions doc/lib/assert_ok/sidebar-items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
window.SIDEBAR_ITEMS = {};
Loading

0 comments on commit cd59bcc

Please sign in to comment.