set ::tests_failed {}
proc assert {condition} {
- if {![uplevel 1 expr $condition]} {
- error "assertion:Expected '$value' to be true"
+ if {![uplevel 1 [list expr $condition]]} {
+ error "assertion:Expected condition '$condition' to be true ([uplevel 1 [list subst -nocommands $condition]])"
}
}
proc colorstr {color str} {
if {[color_term]} {
+ set b 0
+ if {[string range $color 0 4] eq {bold-}} {
+ set b 1
+ set color [string range $color 5 end]
+ }
switch $color {
red {set colorcode {31}}
green {set colorcode {32}}
blue {set colorcode {34}}
magenta {set colorcode {35}}
cyan {set colorcode {36}}
- else {set colorcode {37}}
+ white {set colorcode {37}}
+ default {set colorcode {37}}
}
if {$colorcode ne {}} {
- return "\033\[0;${colorcode};40m$str\033\[0m"
+ return "\033\[$b;${colorcode};40m$str\033\[0m"
}
} else {
return $str
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
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
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"]
}
}