diff options
author | andreas_kupries <akupries@shaw.ca> | 2008-07-23 20:45:08 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2008-07-23 20:45:08 (GMT) |
commit | 2041c85d62dba1eac0c108bf85727787164941da (patch) | |
tree | 350e642622f701d7e7996cdc4cb1ac86d4ee4ffd /tests | |
parent | 60cf559044682964bf4e53b529e793086cb394a6 (diff) | |
download | tcl-2041c85d62dba1eac0c108bf85727787164941da.zip tcl-2041c85d62dba1eac0c108bf85727787164941da.tar.gz tcl-2041c85d62dba1eac0c108bf85727787164941da.tar.bz2 |
* generic/tclBasic.c: Modified TclArgumentGet to reject pure lists
* generic/tclCmdIL.c: immediately, without search. Reworked setup
* generic/tclCompile.c: of eoFramePtr, doesn't need the line
* tests/info.test: information, more sensible to have everything
on line 1 when eval'ing a pure list. Updated the users of the line
information to special case this based on the frame type (i.e.
TCL_LOCATION_EVAL_LIST). Added a testcase demonstrating the new
behaviour.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/info.test | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/tests/info.test b/tests/info.test index 22ed8ca..35297b3 100644 --- a/tests/info.test +++ b/tests/info.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: info.test,v 1.24.2.6 2008/06/16 20:46:16 andreas_kupries Exp $ +# RCS: @(#) $Id: info.test,v 1.24.2.7 2008/07/23 20:45:18 andreas_kupries Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -698,7 +698,7 @@ proc reduce {frame} { incr pos set cmd [lindex $frame $pos] if {[regexp \n $cmd]} { - set first [string range [lindex [split $cmd \n] 0] 0 end-11] + set first [lindex [split $cmd \n] 0] ; set first [expr {[string length $first] > 11 ? [string range $first 0 end-11] : [string range $first 0 end-4]}] set frame [lreplace $frame $pos $pos $first] } set pos [lsearch -exact $frame file] @@ -744,17 +744,17 @@ test info-22.2 {info frame, bad level absolute} tip280 { set msg } {bad level "9"} -test info-22.3 {info frame, current, relative} tip280 { +test info-22.3 {info frame, current, relative} -constraints tip280 -match glob -body { info frame 0 -} {type eval line 2 cmd {info frame 0} proc ::tcltest::RunTest} +} -result {type source line 748 file *info.test cmd {info frame 0} proc ::tcltest::RunTest} -test info-22.4 {info frame, current, relative, nested} tip280 { +test info-22.4 {info frame, current, relative, nested} -constraints tip280 -match glob -body { set res [info frame 0] -} {type eval line 2 cmd {info frame 0} proc ::tcltest::RunTest} +} -result {type source line 752 file *info.test cmd {info frame 0} proc ::tcltest::RunTest} -test info-22.5 {info frame, current, absolute} tip280 { +test info-22.5 {info frame, current, absolute} -constraints tip280 -match glob -body { reduce [info frame 7] -} {type eval line 2 cmd {info frame 7} proc ::tcltest::RunTest} +} -result {type source line 756 file *info.test cmd {info frame 7} proc ::tcltest::RunTest} test info-22.6 {info frame, global, relative} tip280 { reduce [info frame -6] @@ -767,7 +767,7 @@ test info-22.7 {info frame, global, absolute} tip280 { test info-22.8 {info frame, basic trace} tip280 { join [etrace] \n } {8 {type source line 723 file info.test cmd {info frame $level} proc ::etrace level 0} -7 {type eval line 2 cmd etrace proc ::tcltest::RunTest} +7 {type source line 768 file info.test cmd etrace proc ::tcltest::RunTest} 6 {type source line 2277 file tcltest.tcl cmd {uplevel 1 $script} proc ::tcltest::RunTest} 5 {type eval line 1 cmd {::tcltest::RunTest } proc ::tcltest::Eval} 4 {type source line 1619 file tcltest.tcl cmd {uplevel 1 $script} proc ::tcltest::Eval} @@ -788,11 +788,11 @@ test info-23.2 {eval'd info frame, dynamic} tip280 { eval $script } 8 -test info-23.3 {eval'd info frame, literal} tip280 { +test info-23.3 {eval'd info frame, literal} -constraints tip280 -match glob -body { eval { info frame 0 } -} {type eval line 2 cmd {info frame 0} proc ::tcltest::RunTest} +} -result {type source line 793 file *info.test cmd {info frame 0} proc ::tcltest::RunTest} test info-23.4 {eval'd info frame, semi-dynamic} tip280 { eval info frame 0 @@ -808,7 +808,7 @@ test info-23.6 {eval'd info frame, trace} tip280 { join [eval $script] \n } {9 {type source line 723 file info.test cmd {info frame $level} proc ::etrace level 0} 8 {type eval line 1 cmd etrace proc ::tcltest::RunTest} -7 {type eval line 3 cmd {eval $script} proc ::tcltest::RunTest} +7 {type source line 808 file info.test cmd {eval $script} proc ::tcltest::RunTest} 6 {type source line 2277 file tcltest.tcl cmd {uplevel 1 $script} proc ::tcltest::RunTest} 5 {type eval line 1 cmd {::tcltest::RunTest } proc ::tcltest::Eval} 4 {type source line 1619 file tcltest.tcl cmd {uplevel 1 $script} proc ::tcltest::Eval} @@ -1075,6 +1075,32 @@ namespace delete foo # ------------------------------------------------------------------------- +test info-34.0 {eval pure list, single line} { + # Basically, counting the newline in the word seen through $foo + # doesn't really make sense. It makes a bit of sense if the word + # would have been a string literal in the command list. + # + # Problem: At the point where we see the list elements we cannot + # distinguish the two cases, thus we cannot switch between + # count/not-count, it is has to be one or the other for all + # cases. Of the two possibilities miguel convinced me that 'not + # counting' is the more proper. + set foo {b + c} + set cmd [list foreach $foo {x y} { + set res [join [lrange [etrace] 0 2] \n] + break + }] + eval $cmd + set res +} {10 {type source line 723 file info.test cmd {info frame $level} proc ::etrace level 0} +9 {type eval line 2 cmd etrace proc ::tcltest::RunTest} +8 {type eval line 1 cmd foreac proc ::tcltest::RunTest}} + +# ------------------------------------------------------------------------- + +# ------------------------------------------------------------------------- + # cleanup catch {namespace delete test_ns_info1 test_ns_info2} ::tcltest::cleanupTests |