← all modules
module

stdlib::testing

defined in C:\Users\bye45\.glide\bin/src/stdlib/testing.glide

Fails the current test if `cond` is false. The macro evaluates `cond`

fn fn _test_begin(name: string)
fn fn _test_pass()
fn fn _test_fail(msg: string)
fn fn _test_summary() -> int
fn fn _test_count_passed() -> int
fn fn _test_count_failed() -> int
macro macro assert!

Fails the current test if cond is false. The macro evaluates cond once; build descriptive context into the expression itself or use assert_eq! / assert_str_eq! for tailored failure messages.

glide
assert!(v.len() > 0);
assert!(user.age >= 18);
macro macro assert_msg!

Like assert! but takes a custom failure message. The message is a regular string expression, so string interpolation works:

glide
let n: int = compute();
assert_msg!(n > 0, "expected positive, got ${n}");
macro macro assert_eq!

Numeric / boolean / char equality. Uses C ==, so DON'T use this for strings — reach for assert_str_eq! instead. On failure, prints both values via format!'s type-aware formatter.

glide
assert_eq!(parse_int("42").val, 42);
assert_eq!(true, !false);
macro macro assert_str_eq!

String equality via .eq(). assert_eq! would compare pointers and almost always fail; use this whenever either side is a string.

glide
assert_str_eq!(name.to_lower(), "alice");
macro macro assert_not!

Convenience for assert!(!cond) with a clearer failure message.

fn fn test_begin(name: string)

Mark the start of a test. The glide test driver emits this before calling each test_* function; manual callers don't need it. Public so the synthesised driver code can reach it across modules.

fn fn test_pass()

Tick the per-test pass counter. Called by the driver after a test returns without any failed assertion.

fn fn test_summary() -> int

Print the run summary (N passed, M failed) and return the number of failed tests. The driver uses the return as the process exit code.

fn fn test_counts() -> *Vector<int>

(passed, failed) for the current run. Useful for self-tests of the framework.