diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | library/init.tcl | 5 | ||||
-rw-r--r-- | tests/init.test | 15 |
3 files changed, 23 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2005-05-24 Don Porter <dgp@users.sourceforge.net> + + * library/init.tcl: Updated [unknown] to be sure the [return] + * tests/init.test: options from an auto-loaded command are + seen correctly by the caller. + 2005-05-24 Daniel Steffen <das@users.sourceforge.net> * tests/env.test: added DYLD_FRAMEWORK_PATH to the list of env vars diff --git a/library/init.tcl b/library/init.tcl index 4e167af..0623488 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -3,7 +3,7 @@ # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. # -# RCS: @(#) $Id: init.tcl,v 1.75 2005/05/10 18:34:54 kennykb Exp $ +# RCS: @(#) $Id: init.tcl,v 1.76 2005/05/24 19:13:45 dgp Exp $ # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -293,7 +293,8 @@ proc unknown args { return -code error -errorcode $errorCode \ -errorinfo $einfo $msg } else { - return -code $code $msg + dict incr opts -level + return -options $opts $msg } } } diff --git a/tests/init.test b/tests/init.test index 7fc8baa..694ce74 100644 --- a/tests/init.test +++ b/tests/init.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: init.test,v 1.13 2004/10/26 16:46:16 dgp Exp $ +# RCS: @(#) $Id: init.test,v 1.14 2005/05/24 19:13:46 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -196,6 +196,19 @@ foreach arg [subst -nocommands -novariables { incr count } +test init-5.0 {return options passed through ::unknown} -setup { + catch {rename xxx {}} + set ::auto_index(::xxx) {proc ::xxx {} { + return -code error -level 2 xxx + }} +} -body { + set code [catch {::xxx} foo bar] + set code2 [catch {::xxx} foo2 bar2] + list $code $foo $bar $code2 $foo2 $bar2 +} -cleanup { + unset ::auto_index(::xxx) +} -result {2 xxx {-code 1 -level 1} 2 xxx {-code 1 -level 1}} + cleanupTests } ;# End of [interp eval $testInterp] |