diff options
author | dgp <dgp@users.sourceforge.net> | 2009-09-28 03:22:04 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2009-09-28 03:22:04 (GMT) |
commit | 46de449b25360bf9fc69f9e2acfc177db7dd7ee6 (patch) | |
tree | d3f2503d140b54ffade2abe6fd55072450971173 | |
parent | 816780ff7b5566020f5e676eb6ca0e77c6347e41 (diff) | |
download | tcl-46de449b25360bf9fc69f9e2acfc177db7dd7ee6.zip tcl-46de449b25360bf9fc69f9e2acfc177db7dd7ee6.tar.gz tcl-46de449b25360bf9fc69f9e2acfc177db7dd7ee6.tar.bz2 |
* tests/error.test (error-15.8.*): Coverage tests illustrating
flaws in the propagation of return options by [try].
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | tests/error.test | 19 |
2 files changed, 23 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2009-09-27 Don Porter <dgp@users.sourceforge.net> + + * tests/error.test (error-15.8.*): Coverage tests illustrating + flaws in the propagation of return options by [try]. + 2009-09-26 Donal K. Fellows <dkf@users.sf.net> * unix/tclooConfig.sh, win/tclooConfig.sh: [Bug 2026844]: Added dummy diff --git a/tests/error.test b/tests/error.test index 4eb765e..334ba29 100644 --- a/tests/error.test +++ b/tests/error.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: error.test,v 1.19 2009/03/09 09:12:39 dkf Exp $ +# RCS: @(#) $Id: error.test,v 1.20 2009/09/28 03:22:04 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -491,6 +491,23 @@ test error-15.7 {try with no matching handler (unknown integer result propagates try { return -level 0 -code 123456 } trap {} {} { list a b c } } -returnCodes 123456 -result {} +foreach level {0 1 2} { + foreach code {0 1 2 3 4 5} { + + # Following cases have different -errorinfo; avoid false alarms + if {$level == 0 && $code == 1} continue + + foreach extras {{} {-bar soom}} { +test error-15.8.$level.$code.[llength $extras] {[try] coverage} { + set script {return -level $level -code $code {*}$extras foo} + catch $script m1 o1 + catch {try $script} m2 o2 + expr {$o1 eq $o2 ? "ok" : "$o1\n\tis not equal to\n$o2"} +} ok + } + } +} + # try tests - propagation (exceptions in handlers, exception chaining) test error-16.1 {try with successfully executed handler} { |