diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-06-10 13:35:40 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-06-10 14:00:34 +1000 |
commit | e9118354d9d44f452775863208cdd60c1dba13a2 (patch) | |
tree | e4cf99f57ed23081bf078f88562cb853e08dc629 | |
parent | b9a0bdb13db165e0ba8971998dad6e1e77bb883e (diff) | |
download | jimtcl-e9118354d9d44f452775863208cdd60c1dba13a2.zip jimtcl-e9118354d9d44f452775863208cdd60c1dba13a2.tar.gz jimtcl-e9118354d9d44f452775863208cdd60c1dba13a2.tar.bz2 |
Slightly more efficient proc test
Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r-- | tests/testing.tcl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/testing.tcl b/tests/testing.tcl index ccebc70..a04c295 100644 --- a/tests/testing.tcl +++ b/tests/testing.tcl @@ -111,7 +111,8 @@ proc bytestring {x} { # Note: We don't support -output or -errorOutput yet proc test {id descr args} { - if {[lindex $args 0] ni {-returnCodes -body -match -constraints -result -setup -output -errorOutput}} { + set a [dict create -returnCodes {ok return} -match exact -result {} -constraints {} -body {} -setup {} -cleanup {}] + if {[lindex $args 0] ni [dict keys $a]} { if {[llength $args] == 2} { lassign $args body result constraints } elseif {[llength $args] == 3} { @@ -122,7 +123,6 @@ proc test {id descr args} { tailcall test $id $descr -body $body -result $result -constraints $constraints } # tcltest::test v2 syntax - set a {-returnCodes {ok return} -match exact -result {} -constraints {} -body {} -setup {} -cleanup {}} array set a $args incr ::testinfo(numtests) @@ -144,7 +144,7 @@ proc test {id descr args} { } catch {uplevel 1 $a(-setup)} - set rc [catch {uplevel 1 $a(-body)} result] + set rc [catch {uplevel 1 $a(-body)} result opts] catch {uplevel 1 $a(-cleanup)} if {[info return $rc] ni $a(-returnCodes)} { |