]>
Commit | Line | Data |
---|---|---|
98578b57 PN |
1 | set ::passed 0 |
2 | set ::failed 0 | |
3 | set ::testnum 0 | |
4 | ||
5 | proc test {name code okpattern} { | |
6 | incr ::testnum | |
7 | # if {$::testnum < $::first || $::testnum > $::last} return | |
ab72b483 | 8 | puts -nonewline [format "#%03d %-68s " $::testnum $name] |
98578b57 | 9 | flush stdout |
fdfb02e7 | 10 | if {[catch {set retval [uplevel 1 $code]} error]} { |
436f18b6 PN |
11 | puts "EXCEPTION" |
12 | puts "\nCaught error: $error" | |
13 | error "exception" | |
fdfb02e7 | 14 | } |
98578b57 PN |
15 | if {$okpattern eq $retval || [string match $okpattern $retval]} { |
16 | puts "PASSED" | |
17 | incr ::passed | |
18 | } else { | |
19 | puts "!! ERROR expected\n'$okpattern'\nbut got\n'$retval'" | |
20 | incr ::failed | |
21 | } | |
22 | if {$::traceleaks} { | |
23 | if {![string match {*0 leaks*} [exec leaks redis-server]]} { | |
24 | puts "--------- Test $::testnum LEAKED! --------" | |
25 | exit 1 | |
26 | } | |
27 | } | |
28 | } |