]> git.saurik.com Git - redis.git/blobdiff - tests/support/test.tcl
Redis test: when assertion fails print not just the expression but also expanded...
[redis.git] / tests / support / test.tcl
index 0fca618222f0c943560292da0cd9acafed123205..e53d497bb3d79c35ac86fb771266a82bda7b20fd 100644 (file)
@@ -5,7 +5,7 @@ set ::tests_failed {}
 
 proc assert {condition} {
     if {![uplevel 1 expr $condition]} {
-        error "assertion:Expected '$value' to be true"
+        error "assertion:Expected condition '$condition' to be true ([uplevel 1 [list subst -nocommands $condition]])"
     }
 }
 
@@ -98,9 +98,7 @@ proc test {name code {okpattern undefined}} {
 
     incr ::num_tests
     set details {}
-    lappend details $::curfile
-    lappend details $::tags
-    lappend details $name
+    lappend details "$name in $::curfile"
 
     send_data_packet $::test_server_fd testing $name
 
@@ -111,7 +109,7 @@ proc test {name code {okpattern undefined}} {
             lappend ::tests_failed $details
 
             incr ::num_failed
-            send_data_packet $::test_server_fd err $name
+            send_data_packet $::test_server_fd err [join $details "\n"]
         } else {
             # Re-raise, let handler up the stack take care of this.
             error $error $::errorInfo
@@ -126,7 +124,7 @@ proc test {name code {okpattern undefined}} {
             lappend ::tests_failed $details
 
             incr ::num_failed
-            send_data_packet $::test_server_fd err $name
+            send_data_packet $::test_server_fd err [join $details "\n"]
         }
     }