Arsert
Fancy (received pronunciation) assertions with automatic debug information for failures
Install / Use
/learn @antifuchs/ArsertREADME
This project is quasi-abandoned
While I thought this could be a fun exercise to learn rust proc macros, the ecosystem has both moved on quickly enough (allowing tests that return Result) and stayed in place long enough (not stabilizing expression proc macros) that this crate is now useless (or, worse than that, actively harmful). Don't use this.
arsert
arsert - assertions that fail very sophisticatedly
This crate allows you to write assertions like you would with a
builtin [assert][assert], but when the assertion fails, it outputs
diagnostic information about the parameters to the assertion.
Usage
Here's a failing assertion:
use arsert::arsert;
let x = 1;
let y: i32 = 2;
arsert!(x >= y.pow(3));
This outputs:
thread 'main' panicked at 'x >= y . pow ( 3 )
x = 1
y . pow ( 3 ) = 8', arsert_failure/src/lib.rs:23:5
Here's a successful one:
use arsert::arsert;
let x = 20 as i64;
arsert!(x <= x.pow(3));
Supported operations
Right now, arsert supports "simple" assertions (very much like
assert does), unary assertions (e.g. *foo and !foo), and
assertions on binary operations, like ==, >, && and so on.
I'm working on more supported expressions (and maybe, once proc_macros as statements get stabilized, an extension mechanism).
The Name
Sorry for the toilet humor (everybody poops, y'all). Name improvement suggestions gladly accepted, provided the resulting name is terse and meaningful.
License: MIT
Related Skills
node-connect
339.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.8kCommit, push, and open a PR
