File: assert.tcl

package info (click to toggle)
staden 2.0.0%2Bb11-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,584 kB
  • sloc: ansic: 240,605; tcl: 65,360; cpp: 12,854; makefile: 11,203; sh: 3,023; fortran: 2,033; perl: 63; awk: 46
file content (9 lines) | stat: -rw-r--r-- 232 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
#
# Assert function. If "expr" is false we generate a Tcl error to be dealth
# with by the normal error handler.
#
proc assert {expr} {
    if {![uplevel 1 [list expr $expr]]} {
	return -code error "Assertion failed: $expr"
    }
}