diff options
Diffstat (limited to 'tests/info.test')
-rw-r--r-- | tests/info.test | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/tests/info.test b/tests/info.test index b25f4a6..9a919bc 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.76 2010/04/05 19:44:45 ferrieux Exp $ +# RCS: @(#) $Id: info.test,v 1.77 2010/08/03 16:58:01 andreas_kupries Exp $ if {{::tcltest} ni [namespace children]} { package require tcltest 2 @@ -1837,6 +1837,47 @@ test info-30.48 {Bug 2850901} testevalex { ][reduce [info frame 0]]} ; # line 2 of the eval } {type eval line 2 cmd {info frame 0} proc ::tcltest::RunTest} + +# ------------------------------------------------------------------------- +# literal sharing 2, bug 2933089 + +test info-39.1 {location information not confused by literal sharing, bug 2933089} -setup { + set result {} + + proc print_one {} {} + proc test_info_frame {} { + set x 1 + set y x + + if "$x != 1" { + } else { + print_one + } ;#line 1855^ + + if "$$y != 1" { + } else { + print_one + } ;#line 1860^ + # Do not put the comments listing the line numbers into the + # branches. We need shared literals, and the comments would + # make them different, thus unshared. + } + + proc get_frame_info { cmd_str op } { + lappend ::result [reduce [eval {info frame -3}]] + } + trace add execution print_one enter get_frame_info +} -body { + test_info_frame; + join $result \n +} -cleanup { + trace remove execution print_one enter get_frame_info + rename get_frame_info {} + rename test_info_frame {} + rename print_one {} +} -result {type source line 1855 file info.test cmd print_one proc ::test_info_frame level 1 +type source line 1860 file info.test cmd print_one proc ::test_info_frame level 1} + # ------------------------------------------------------------------------- unset -nocomplain res |