summaryrefslogtreecommitdiffstats
path: root/tests/rename.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/rename.test')
-rw-r--r--tests/rename.test118
1 files changed, 60 insertions, 58 deletions
diff --git a/tests/rename.test b/tests/rename.test
index aa5f900..bd14578 100644
--- a/tests/rename.test
+++ b/tests/rename.test
@@ -16,6 +16,8 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
namespace import -force ::tcltest::*
}
+testConstraint testdel [llength [info commands testdel]]
+
# Must eliminate the "unknown" command while the test is running,
# especially if the test is being run in a program with its
# own special-purpose unknown command.
@@ -75,65 +77,63 @@ catch {rename unknown {}}
catch {rename unknown.old unknown}
catch {rename bar {}}
-if {[info command testdel] == "testdel"} {
- test rename-4.1 {reentrancy issues with command deletion and renaming} {
- set x {}
- testdel {} foo {lappend x deleted; rename bar {}; lappend x [info command bar]}
- rename foo bar
- lappend x |
- rename bar {}
- set x
- } {| deleted {}}
- test rename-4.2 {reentrancy issues with command deletion and renaming} {
- set x {}
- testdel {} foo {lappend x deleted; rename foo bar}
- rename foo {}
- set x
- } {deleted}
- test rename-4.3 {reentrancy issues with command deletion and renaming} {
- set x {}
- testdel {} foo {lappend x deleted; testdel {} foo {lappend x deleted2}}
- rename foo {}
- lappend x |
- rename foo {}
- set x
- } {deleted | deleted2}
- test rename-4.4 {reentrancy issues with command deletion and renaming} {
- set x {}
- testdel {} foo {lappend x deleted; rename foo bar}
- rename foo {}
- lappend x | [info command bar]
- } {deleted | {}}
- test rename-4.5 {reentrancy issues with command deletion and renaming} {
- set env(value) before
- interp create foo
- testdel foo cmd {set env(value) deleted}
+test rename-4.1 {reentrancy issues with command deletion and renaming} testdel {
+ set x {}
+ testdel {} foo {lappend x deleted; rename bar {}; lappend x [info command bar]}
+ rename foo bar
+ lappend x |
+ rename bar {}
+ set x
+} {| deleted {}}
+test rename-4.2 {reentrancy issues with command deletion and renaming} testdel {
+ set x {}
+ testdel {} foo {lappend x deleted; rename foo bar}
+ rename foo {}
+ set x
+} {deleted}
+test rename-4.3 {reentrancy issues with command deletion and renaming} testdel {
+ set x {}
+ testdel {} foo {lappend x deleted; testdel {} foo {lappend x deleted2}}
+ rename foo {}
+ lappend x |
+ rename foo {}
+ set x
+} {deleted | deleted2}
+test rename-4.4 {reentrancy issues with command deletion and renaming} testdel {
+ set x {}
+ testdel {} foo {lappend x deleted; rename foo bar}
+ rename foo {}
+ lappend x | [info command bar]
+} {deleted | {}}
+test rename-4.5 {reentrancy issues with command deletion and renaming} testdel {
+ set env(value) before
+ interp create foo
+ testdel foo cmd {set env(value) deleted}
+ interp delete foo
+ set env(value)
+} {deleted}
+test rename-4.6 {reentrancy issues with command deletion and renaming} testdel {
+ proc kill args {
+ interp delete foo
+ }
+ set env(value) before
+ interp create foo
+ foo alias kill kill
+ testdel foo cmd {set env(value) deleted; kill}
+ list [catch {foo eval {rename cmd {}}} msg] $msg $env(value)
+} {0 {} deleted}
+test rename-4.7 {reentrancy issues with command deletion and renaming} testdel {
+ proc kill args {
interp delete foo
- set env(value)
- } {deleted}
- test rename-4.6 {reentrancy issues with command deletion and renaming} {
- proc kill args {
- interp delete foo
- }
- set env(value) before
- interp create foo
- foo alias kill kill
- testdel foo cmd {set env(value) deleted; kill}
- list [catch {foo eval {rename cmd {}}} msg] $msg $env(value)
- } {0 {} deleted}
- test rename-4.7 {reentrancy issues with command deletion and renaming} {
- proc kill args {
- interp delete foo
- }
- set env(value) before
- interp create foo
- foo alias kill kill
- testdel foo cmd {set env(value) deleted; kill}
- list [catch {interp delete foo} msg] $msg $env(value)
- } {0 {} deleted}
- if {[info exists env(value)]} {
- unset env(value)
}
+ set env(value) before
+ interp create foo
+ foo alias kill kill
+ testdel foo cmd {set env(value) deleted; kill}
+ list [catch {interp delete foo} msg] $msg $env(value)
+} {0 {} deleted}
+if {[info exists env(value)]} {
+ unset env(value)
}
# Save the unknown procedure which is modified by the following test.
@@ -158,7 +158,7 @@ catch {rename unknown.old unknown}
test rename-6.1 {old code invalidated (epoch incremented) when cmd with compile proc is renamed } {
- proc x {} {
+ proc x {} {
set a 123
set b [incr a]
}
@@ -166,6 +166,8 @@ test rename-6.1 {old code invalidated (epoch incremented) when cmd with compile
rename incr incr.old
proc incr {} {puts "new incr called!"}
catch {x} msg
+ rename incr {}
+ rename incr.old incr
set msg
} {wrong # args: should be "incr"}