Files
rose-ash/lib/tcl/tests/programs/assert.tcl
giles 95b22a648d
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 42s
tcl: classic programs — for-each-line, assert, with-temp-var (+3 tests, 228 total)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 09:34:26 +00:00

14 lines
223 B
Tcl

proc assert {expr_str} {
set result [uplevel 1 [list expr $expr_str]]
if {!$result} {
error "Assertion failed: $expr_str"
}
}
set x 42
assert {$x == 42}
assert {$x > 0}
set x 10
assert {$x < 100}
set x