Assertables: a Rust crate of assert macros for testing
Find a file
2026-05-31 21:25:18 +01:00
.claude Upgrade to 10.0.0 with new Assertables and Rust edition 2024. 2026-05-23 18:00:40 +01:00
.github/workflows Add GitHub Actions workflow for Rust project 2026-04-02 09:20:05 +01:00
bin Rename assert_process params akin to assert_command params 2024-10-31 17:12:54 +01:00
doc Upgrade to 10.0.0 with new Assertables and Rust edition 2024. 2026-05-23 18:00:40 +01:00
help Add sota-scan 2026-05-31 21:25:18 +01:00
src Upgrade to 10.0.0 with new Assertables and Rust edition 2024. 2026-05-23 18:00:40 +01:00
tests Upgrade to 10.0.0 with new Assertables and Rust edition 2024. 2026-05-23 18:00:40 +01:00
.gitignore Refactor rustdoc to use dynamic crate version 2024-10-05 01:49:49 +02:00
alfa.txt Add assert_fs_read_to_string_* doc tests 2024-09-02 17:34:05 +02:00
assertables.md Upgrade to 10.0.0 with new Assertables and Rust edition 2024. 2026-05-23 18:00:40 +01:00
bravo.txt Add assert_fs_read_to_string_* doc tests 2024-09-02 17:34:05 +02:00
build.rs Fix doc typos 2026-05-23 17:02:48 +01:00
Cargo.toml Move developer local dependencies into comments 2026-05-05 20:47:52 +01:00
CHANGES.md Upgrade to 10.0.0 with new Assertables and Rust edition 2024. 2026-05-23 18:00:40 +01:00
CITATION.cff Migrate from SixArm organization to Assertables organization 2026-05-05 20:28:02 +01:00
CODE_OF_CONDUCT.md Add documentation 2021-04-01 05:30:37 -07:00
CODEOWNERS Migrate from SixArm organization to Assertables organization 2026-05-05 20:28:02 +01:00
CONTRIBUTING.md Migrate from SixArm organization to Assertables organization 2026-05-05 20:28:02 +01:00
cspell.json Release 9.8.0 2025-06-23 23:32:07 +01:00
deny.toml Add assert_all_* & assert_any_* 2026-04-15 11:43:07 +01:00
funding.json Migrate from SixArm organization to Assertables organization 2026-05-05 20:28:02 +01:00
LICENSE.md Rename assert_process params akin to assert_command params 2024-10-31 17:12:54 +01:00
llms.json Upgrade to 10.0.0 with new Assertables and Rust edition 2024. 2026-05-23 18:00:40 +01:00
llms.txt Upgrade to 10.0.0 with new Assertables and Rust edition 2024. 2026-05-23 18:00:40 +01:00
README.md Add help for src/lib.rs 2026-05-26 19:08:49 +01:00

Assertables: assert macros for better testing

Assertables is a Rust crate of assert macros to improve your compile-time tests and run-time reliability.

documentationcomparisonsllmsemailcodebergcrates.iogithubgitlab

Introduction

The Assertables Rust crate provides many assert macros that can help you develop, test, and debug.

This documentation is also available as llms.txt.

To use this crate, add it to your file Cargo.toml:

assertables = "10.0.0"

To enable all the assert macros everywhere in your code, add it to your src/lib.rs:

#[cfg(test)]
#[macro_use] extern crate assertables;

Benefits:

  • You can write better tests to improve reliability and maintainability.
  • You can handle more corner cases without needing to write custom code.
  • You can troubleshoot faster because error messages show more detail.

Learning: FAQ, docs, examples, changes, upgrades, developing.

Comparisons: more_asserts, cool_asserts, assert2, claims, etc.

Examples

Examples with numbers:

let i = 1;
assert_lt!(i, 2);
assert_in_range!(&i, 0..2);

Examples with strings:

let s = "hello";
assert_starts_with!(s, "h");
assert_is_match!(Regex::new(r"e.*o").unwrap(), s);

Examples with arrays:

let a = [1, 2, 3];
assert_contains!(a, &2);
assert_all!(a.iter(), |i: i32| i < 4);

Highlights

Values:

Floats:

Approximations:

Nearness:

Groups:

Matching:

Results:

Options:

Polls:

Readers:

Iterators:

Sets:

Bags:

Commands:

Status:

Infix values:

Infix logic:

For a complete list of modules and macros, see the docs.

Forms

All the macros have forms for an optional message:

All the macros have forms for different outcomes:

Many of the macros have a form "compare left item to right item" that compares items of the same kind, and a form "compare left item to right expression" that compares one item to any arbitrary expression:

Many of the macros has a "success return", which means the macro returns data that you can optionally use for more testing.

Tracking

  • Package: assertables-rust-crate
  • Version: 10.0.0
  • Created: 2021-03-30T15:47:49Z
  • Updated: 2026-05-23T16:03:31Z
  • License: MIT or BSD or Apache-2.0 or GPL-2.0 or GPL-3.0 or contact us for more
  • Contact: Joel Parker Henderson joel@joelparkerhenderson.com