commit - 8dc949b075675abad57847c27ef695ecf419cb62
commit + 0eb2a1f6b10ce032f94216e96df1c4a185b3282e
blob - 1cb43054bbaba6dfe115061e321fe94b01bd16d8
blob + 0d53aa841f05888d803febdf56df90a0379fe5f8
--- exercise
+++ exercise
return "\033\[${c}m$s\033\[0m"
}
+proc inconsistent {counters} {
+ dict with counters {
+ expr {$run != $ok + $fail + $error}
+ }
+}
+
proc notok {counters} {
dict with counters {
- expr {$ok!=$run || $fail>0 || $error>0}
+ expr {[inconsistent $counters] || $ok != $run}
}
}
}
}
- if {!$run == $ok + $fail + $error} {
+ if {[inconsistent $counters]} {
return -code error -errorcode EXER_SUITE \
"counters do not sum up: $counters"
}
}
if {!$opts(-q)} {puts [summary $counters]}
- # TODO: sanity-check counters, exit 127 (?) if mismatched
+ # sanity-check counters, exit 127 if mismatched (should never happen)
+ if {[inconsistent $counters]} {
+ puts stderr "[file tail $::argv0]: inconsistent counters: $counters"
+ exit 127
+ }
+
exit [notok $counters]
}