I like use tcltest in my daily testing tasks. But test results i can only see in console, so after each test run i need to switch to that console, to find results. Аccording to
You might want to simplify your setup and stay in Tcl? Redirecting stdout (which is used by tcltest
under the hood) using Tcl's channel transforms is a convenient option; and has been covered here before.
There are many variations to this theme, but you might want to get started by:
oo::class create TcltestNotifier {
variable buffer
method initialize {handle mode} {
if {$mode ne "write"} {error "can't handle reading"}
return {finalize initialize write}
}
method finalize {handle} {
# NOOP
}
method write {handle bytes} {
append buffer $bytes
return $bytes
}
method report {} {
# sanitize the tcltest report for the notifier
set buffer [string map {\" \\\"} $buffer]
# dispatch to notifier (Mac OS X, change to your needs/ OS)
append cmd "display notification \"$buffer\"" " "
append cmd "with title \"Tcltest notification\""
exec osascript -e $cmd
}
}
The above snippet was derived/ stolen bluntly from Donal.
stdout
around your tcltest
suitepackage req tcltest
namespace import ::tcltest::*
set tn [TcltestNotifier new]
chan push stdout $tn
test mytest-0.1 "Fails!" -body {
BARF!;
} -result "?"
chan pop stdout
$tn report
write
method). But I doubt that this makes sense.osascript
), you have to modify it to your *nix tooling.