Assertion.hx
Quick assertions and traces with macros
Install / Use
/learn @protocubo/Assertion.hxREADME
Quick assertions and traces with macros

Usage
import Assertion.*;
[...]
var foo = "a";
// basic `assert`, that throws if the condition fails
assert(foo == "bar");
// trace some context if the assertion fails
// you can add as many expressions to trace as you need
assert(foo == "bar", foo, Sys.systemName());
// trace expressions consisting of string literals are automatically threated as descriptions
assert(foo.length == 3, "correct length at least");
// if you just want a warning, instead of a throw, use `weakAssert`
weakAssert(foo == "bar");
// if you just want to trace like us, use `show`
show(foo, Sys.systemName(), "show everything");
Configuring
Assertion works out of the box without any configuration, but in some
cases you might want to change or disable certain default behaviors.
You can configure the library both at compile time and runtime.
Compile time configuration
Use -D ASSERTION_NO_ASSERT to disable the generation of all assertions (both
regular and weak).
You can also use -D ASSERTION_NO_WEAK_ASSERT to only disable the generation
of weak assertions. Similarly, you can disable the generation of code for
show with -D ASSERTION_NO_SHOW.
Runtime configuration
Similarly to the compile time settings, you can use the following variables to
alter the behavior of Assertion at runtime:
Assertion.enableAssert(defaults totrue)Assertion.enableWeakAssert(defaults totrue)Assertion.enableShow(defaults totrue)
Additionally, the runtime behavior can be considerably customized by replacing
assertion.Tools.runtime with a suitable implementation.
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate 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
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
