summaryrefslogtreecommitdiff
path: root/tests/support/test.tcl
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2010-05-14 18:48:33 +0200
committerantirez <antirez@gmail.com>2010-05-14 18:48:33 +0200
commitab72b4833d2054231437acccec36f32f07290075 (patch)
tree9d66fa4f98c60913ba86e3767d054ddacb291eff /tests/support/test.tcl
parent47868511523c855799c315977b5d480f6f15a4be (diff)
downloadredis-ab72b4833d2054231437acccec36f32f07290075.tar.gz
minor fixes to the new test suite, html doc updated
Diffstat (limited to 'tests/support/test.tcl')
-rw-r--r--tests/support/test.tcl24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/support/test.tcl b/tests/support/test.tcl
new file mode 100644
index 000000000..c695c82fa
--- /dev/null
+++ b/tests/support/test.tcl
@@ -0,0 +1,24 @@
+set ::passed 0
+set ::failed 0
+set ::testnum 0
+
+proc test {name code okpattern} {
+ incr ::testnum
+ # if {$::testnum < $::first || $::testnum > $::last} return
+ puts -nonewline [format "#%03d %-68s " $::testnum $name]
+ flush stdout
+ set retval [uplevel 1 $code]
+ 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
+ }
+ }
+}