Diff
Not logged in

Differences From Artifact [ae36bfa2fe]:

To Artifact [1db27cac8b]:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
# Commands covered:  trace
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: trace.test,v 1.47 2005/11/18 23:42:12 msofer Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import -force ::tcltest::*
}

testConstraint testcmdtrace [llength [info commands testcmdtrace]]


# Used for constraining memory leak tests
testConstraint memory [llength [info commands memory]]

proc getbytes {} {
    set lines [split [memory info] "\n"]
    lindex [lindex $lines 3] 3













|







>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Commands covered:  trace
#
# This file contains a collection of tests for one or more of the Tcl
# built-in commands.  Sourcing this file into Tcl runs the tests and
# generates output for errors.  No output means no errors were found.
#
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: trace.test,v 1.48 2006/02/28 15:47:10 dgp Exp $

if {[lsearch [namespace children] ::tcltest] == -1} {
    package require tcltest
    namespace import -force ::tcltest::*
}

testConstraint testcmdtrace [llength [info commands testcmdtrace]]
testConstraint testevalobjv [llength [info commands testevalobjv]]

# Used for constraining memory leak tests
testConstraint memory [llength [info commands memory]]

proc getbytes {} {
    set lines [split [memory info] "\n"]
    lindex [lindex $lines 3] 3
1589
1590
1591
1592
1593
1594
1595
































1596
1597
1598
1599
1600
1601
1602
test trace-21.8 {trace execution: leavestep} {
    set info {}
    trace add execution foo {leavestep} [list traceExecute foo]
    foo 3
    trace remove execution foo {leavestep} [list traceExecute foo]
    set info
} {{foo {set b 3} 0 3 leavestep}}

































proc factorial {n} {
    if {$n != 1} { return [expr {$n * [factorial [expr {$n -1 }]]}] }
    return 1
}

test trace-22.1 {recursive(1) trace execution: enter} {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
test trace-21.8 {trace execution: leavestep} {
    set info {}
    trace add execution foo {leavestep} [list traceExecute foo]
    foo 3
    trace remove execution foo {leavestep} [list traceExecute foo]
    set info
} {{foo {set b 3} 0 3 leavestep}}

test trace-21.9 {trace execution: TCL_EVAL_GLOBAL} testevalobjv {
    trace add execution foo enter soom
    proc ::soom args {lappend ::info SUCCESS [info level]}
    set ::info {}
    namespace eval test_ns_1 {
        proc soom args {lappend ::info FAIL [info level]}
        # [testevalobjv 1 ...] ought to produce the same
       # results as [uplevel #0 ...].
        testevalobjv 1 foo x
       uplevel #0 foo x
    }
    namespace delete test_ns_1
    trace remove execution foo enter soom
    set ::info
} {SUCCESS 1 SUCCESS 1}
    
test trace-21.10 {trace execution: TCL_EVAL_GLOBAL} testevalobjv {
    trace add execution foo leave soom
    proc ::soom args {lappend ::info SUCCESS [info level]}
    set ::info {}
    namespace eval test_ns_1 {
        proc soom args {lappend ::info FAIL [info level]}
        # [testevalobjv 1 ...] ought to produce the same
       # results as [uplevel #0 ...].
        testevalobjv 1 foo x
       uplevel #0 foo x
    }
    namespace delete test_ns_1
    trace remove execution foo leave soom
    set ::info
} {SUCCESS 1 SUCCESS 1}

proc factorial {n} {
    if {$n != 1} { return [expr {$n * [factorial [expr {$n -1 }]]}] }
    return 1
}

test trace-22.1 {recursive(1) trace execution: enter} {