diff options
author | dgp <dgp@users.sourceforge.net> | 2001-04-06 17:57:31 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2001-04-06 17:57:31 (GMT) |
commit | b80daf1c9480cf551e21ac7661392ed5b0b621ff (patch) | |
tree | ffdfebd57f01286746bfa763f6d46898e39374fd /tests | |
parent | db1db9eb0cc87f32ea08f460c71eac8b6bc1034f (diff) | |
download | tcl-b80daf1c9480cf551e21ac7661392ed5b0b621ff.zip tcl-b80daf1c9480cf551e21ac7661392ed5b0b621ff.tar.gz tcl-b80daf1c9480cf551e21ac7661392ed5b0b621ff.tar.bz2 |
Modified processing of $::errorInfo by [unknown] when the auto-loaded command
throws an error to better cover the tracks of auto-loading.
[Bug 219280, Patch 403551]
Diffstat (limited to 'tests')
-rw-r--r-- | tests/init.test | 64 |
1 files changed, 52 insertions, 12 deletions
diff --git a/tests/init.test b/tests/init.test index 46f4429..c31412b 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.7 2000/05/03 00:14:36 hobbs Exp $ +# RCS: @(#) $Id: init.test,v 1.8 2001/04/06 17:57:32 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -149,21 +149,61 @@ test init-3.0 {random stuff in the auto_index, should still work} { foo:::bar::blah } 1 +# Tests that compare the error stack trace generated when autoloading +# with that generated when no autoloading is necessary. Ideally they +# should be the same. + +set count 0 +foreach arg { + c + {argument + which spans + multiple lines} + {argument which is all on one line but which is of such great length that the Tcl C library will truncate it when appending it onto the global error stack} + {argument which spans multiple lines + and is long enough to be truncated and +" <- includes a false lead in the prune point search + and must be longer still to force truncation} + {contrived example: rare circumstance + where the point at which to prune the + error stack cannot be uniquely determined. + foo bar foo +"} + {contrived example: rare circumstance + where the point at which to prune the + error stack cannot be uniquely determined. + foo bar +"} + } { + + test init-4.$count.0 {::errorInfo produced by [unknown]} { + auto_reset + catch {parray a b $arg} + set first $::errorInfo + catch {parray a b $arg} + set second $::errorInfo + string equal $first $second + } 1 + + test init-4.$count.1 {::errorInfo produced by [unknown]} { + auto_reset + namespace eval junk [list array set $arg [list 1 2 3 4]] + trace variable ::junk::$arg r \ + "[list error [subst {Variable \"$arg\" is write-only}]] ;# " + catch {parray ::junk::$arg} + set first $::errorInfo + catch {parray ::junk::$arg} + set second $::errorInfo + string equal $first $second + } 1 + + incr count } +} ;# End of [interp eval $testInterp] + # cleanup interp delete $testInterp ::tcltest::cleanupTests return - - - - - - - - - - - |