diff options
Diffstat (limited to 'itcl/itcl/tests/methods.test')
-rw-r--r-- | itcl/itcl/tests/methods.test | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/itcl/itcl/tests/methods.test b/itcl/itcl/tests/methods.test index edb1ea88f0e..9906e889080 100644 --- a/itcl/itcl/tests/methods.test +++ b/itcl/itcl/tests/methods.test @@ -13,8 +13,13 @@ # See the file "license.terms" for information on usage and # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. +package require tcltest +namespace import -force ::tcltest::* + if {[string compare test [info procs test]] == 1} then {source defs} +package require Itcl + # ---------------------------------------------------------------------- # Methods with various argument lists # ---------------------------------------------------------------------- @@ -38,9 +43,17 @@ test methods-1.1 {define a class with lots of methods and arg lists} { method clash {x bang boom} { return "clash: $x $bang $boom" } + method clash_time {x bang boom} { + time {set result "clash_time: $x $bang $boom"} 1 + return $result + } proc crash {x bang boom} { return "crash: $x $bang $boom" } + proc crash_time {x bang boom} { + time {set result "crash_time: $x $bang $boom"} 1 + return $result + } variable bang "ok" common boom "no-problem" } @@ -122,7 +135,22 @@ test methods-1.10 {formal args don't clobber class members} { [ta info variable boom -value] } {0 {crash: 4 5 6} ok no-problem} +test methods-1.11 {formal args don't clobber class members, even in "time"} { + list [catch {ta clash_time 7 8 9} msg] $msg \ + [ta info variable bang -value] \ + [ta info variable boom -value] +} {0 {clash_time: 7 8 9} ok no-problem} + +test methods-1.12 {formal args don't clobber class members, even in "time"} { + list [catch {test_args::crash_time a b c} msg] $msg \ + [ta info variable bang -value] \ + [ta info variable boom -value] +} {0 {crash_time: a b c} ok no-problem} + # ---------------------------------------------------------------------- # Clean up # ---------------------------------------------------------------------- -delete class test_args +itcl::delete class test_args + +::tcltest::cleanupTests +return |