696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
|
::tcltest::cleanupTests
return
##
# ### ### ### ######### ######### #########
## info frame
## Helper
# For the more complex results we cut the file name down to remove path
# dependencies, and we use only part of the first line of the reported
# command. The latter is required because otherwise the whole test case may
# appear in some results, but the result is part of the testcase. An infinite
# string would be required to describe that. The cutting-down breaks this.
proc reduce {frame} {
set pos [lsearch -exact $frame cmd]
incr pos
set cmd [lindex $frame $pos]
if {[regexp \n $cmd]} {
set first [string range [lindex [split $cmd \n] 0] 0 end-4]
set frame [lreplace $frame $pos $pos $first]
}
set pos [lsearch -exact $frame file]
if {$pos >=0} {
incr pos
set tail [file tail [lindex $frame $pos]]
set frame [lreplace $frame $pos $pos $tail]
}
set frame
}
proc subinterp {} { interp create sub ; interp debug sub -frame 1;
interp eval sub [list proc reduce [info args reduce] [info body reduce]]
}
## Helper
# Generate a stacktrace from the current location to top. This code
# not only depends on the exact location of things, but also on the
# implementation of tcltest. Any changes and these tests will have to
# be updated.
proc etrace {} {
|
>
>
|
<
<
>
|
<
|
<
<
|
|
|
>
>
|
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
|
::tcltest::cleanupTests
return
##
# ### ### ### ######### ######### #########
## info frame
## Helper
# For the more complex results we cut the file name down to remove path
# dependencies, and we use only part of the first line of the reported
# command. The latter is required because otherwise the whole test case may
# appear in some results, but the result is part of the testcase. An infinite
# string would be required to describe that. The cutting-down breaks this.
proc reduce {frame} {
set cmd [dict get $frame cmd]
if {[regexp \n $cmd]} {
dict set frame cmd \
[string range [lindex [split $cmd \n] 0] 0 end-4]
}
if {[dict exists $frame file]} {
dict set frame file \
[file tail [dict get $frame file]]
}
return $frame
}
proc subinterp {} { interp create sub ; interp debug sub -frame 1;
interp eval sub [list proc reduce [info args reduce] [info body reduce]]
}
## Helper
# Generate a stacktrace from the current location to top. This code
# not only depends on the exact location of things, but also on the
# implementation of tcltest. Any changes and these tests will have to
# be updated.
proc etrace {} {
|
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
|
} -cleanup {
rename abra {}
} -result {type source line 1446 file info.test cmd {info frame 0} proc ::abra level 0}
test info-30.2 {bs+nl in literal words, namespace script} {
namespace eval xxx {
variable res \
[reduce [info frame 0]];# line 1457
}
return $xxx::res
} {type source line 1457 file info.test cmd {info frame 0} level 0}
test info-30.3 {bs+nl in literal words, namespace multi-word script} {
namespace eval xxx variable res \
[list [reduce [info frame 0]]];# line 1464
return $xxx::res
} {type source line 1464 file info.test cmd {info frame 0} proc ::tcltest::RunTest}
|
|
|
|
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
|
} -cleanup {
rename abra {}
} -result {type source line 1446 file info.test cmd {info frame 0} proc ::abra level 0}
test info-30.2 {bs+nl in literal words, namespace script} {
namespace eval xxx {
variable res \
[info frame 0];# line 1457
}
return [reduce $xxx::res]
} {type source line 1457 file info.test cmd {info frame 0} level 0}
test info-30.3 {bs+nl in literal words, namespace multi-word script} {
namespace eval xxx variable res \
[list [reduce [info frame 0]]];# line 1464
return $xxx::res
} {type source line 1464 file info.test cmd {info frame 0} proc ::tcltest::RunTest}
|