diff options
author | gahr <gahr@gahr.ch> | 2016-06-10 12:10:41 (GMT) |
---|---|---|
committer | gahr <gahr@gahr.ch> | 2016-06-10 12:10:41 (GMT) |
commit | 74cee16544d00f49288f1819fb71e1c5c74ce5ad (patch) | |
tree | d77bcc9fb09de474104b1fc59dde7cc6c20b4031 /library/tcltest/tcltest.tcl | |
parent | 8377ed833a9566731442ef744b419425638d5040 (diff) | |
parent | 03462e2c1dfc9da26f049ee17a3001df257442e4 (diff) | |
download | tcl-74cee16544d00f49288f1819fb71e1c5c74ce5ad.zip tcl-74cee16544d00f49288f1819fb71e1c5c74ce5ad.tar.gz tcl-74cee16544d00f49288f1819fb71e1c5c74ce5ad.tar.bz2 |
Merge trunk
Diffstat (limited to 'library/tcltest/tcltest.tcl')
-rw-r--r-- | library/tcltest/tcltest.tcl | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 29ef778..9997187 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -22,7 +22,7 @@ namespace eval tcltest { # When the version number changes, be sure to update the pkgIndex.tcl file, # and the install directory in the Makefiles. When the minor version # changes (new feature) be sure to update the man page as well. - variable Version 2.3.8 + variable Version 2.4.0 # Compatibility support for dumb variables defined in tcltest 1 # Do not use these. Call [package provide Tcl] and [info patchlevel] @@ -611,16 +611,27 @@ namespace eval tcltest { proc AcceptVerbose { level } { set level [AcceptList $level] + set levelMap { + l list + p pass + b body + s skip + t start + e error + l line + m msec + u usec + } + set levelRegexp "^([join [dict values $levelMap] |])\$" if {[llength $level] == 1} { - if {![regexp {^(pass|body|skip|start|error|line)$} $level]} { + if {![regexp $levelRegexp $level]} { # translate single characters abbreviations to expanded list - set level [string map {p pass b body s skip t start e error l line} \ - [split $level {}]] + set level [string map $levelMap [split $level {}]] } } set valid [list] foreach v $level { - if {[regexp {^(pass|body|skip|start|error|line)$} $v]} { + if {[regexp $levelRegexp $v]} { lappend valid $v } } @@ -1972,6 +1983,11 @@ proc tcltest::test {name description args} { # Only run the test body if the setup was successful if {!$setupFailure} { + # Register startup time + if {[IsVerbose msec] || [IsVerbose usec]} { + set timeStart [clock microseconds] + } + # Verbose notification of $body start if {[IsVerbose start]} { puts [outputChannel] "---- $name start" @@ -2076,6 +2092,16 @@ proc tcltest::test {name description args} { } } + if {[IsVerbose msec] || [IsVerbose usec]} { + set t [expr {[clock microseconds] - $timeStart}] + if {[IsVerbose usec]} { + puts [outputChannel] "++++ $name took $t μs" + } + if {[IsVerbose msec]} { + puts [outputChannel] "++++ $name took [expr {round($t/1000.)}] ms" + } + } + # if we didn't experience any failures, then we passed variable numTests if {!($setupFailure || $cleanupFailure || $coreFailure |