2010-05-14 11:31:11 -04:00
|
|
|
set ::passed 0
|
|
|
|
set ::failed 0
|
|
|
|
set ::testnum 0
|
|
|
|
|
|
|
|
proc test {name code okpattern} {
|
|
|
|
incr ::testnum
|
2010-05-14 12:48:33 -04:00
|
|
|
puts -nonewline [format "#%03d %-68s " $::testnum $name]
|
2010-05-14 11:31:11 -04:00
|
|
|
flush stdout
|
2010-05-15 17:48:08 -04:00
|
|
|
if {[catch {set retval [uplevel 1 $code]} error]} {
|
2010-06-02 15:20:29 -04:00
|
|
|
puts "EXCEPTION"
|
|
|
|
puts "\nCaught error: $error"
|
|
|
|
error "exception"
|
2010-05-15 17:48:08 -04:00
|
|
|
}
|
2010-05-14 11:31:11 -04:00
|
|
|
if {$okpattern eq $retval || [string match $okpattern $retval]} {
|
|
|
|
puts "PASSED"
|
|
|
|
incr ::passed
|
|
|
|
} else {
|
|
|
|
puts "!! ERROR expected\n'$okpattern'\nbut got\n'$retval'"
|
|
|
|
incr ::failed
|
|
|
|
}
|
|
|
|
if {$::traceleaks} {
|
|
|
|
if {![string match {*0 leaks*} [exec leaks redis-server]]} {
|
|
|
|
puts "--------- Test $::testnum LEAKED! --------"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|