summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/uplevel.test10
-rw-r--r--tests/upvar.test11
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/uplevel.test b/tests/uplevel.test
index cfe4b72..51ffd34 100644
--- a/tests/uplevel.test
+++ b/tests/uplevel.test
@@ -83,6 +83,16 @@ test uplevel-3.4 {uplevel to same level} {
a1
} 55
+test uplevel-4.0.1 {error: non-existent level} -body {
+ uplevel #0 { uplevel { set y 222 } }
+} -returnCodes error -result {bad level "1"}
+test uplevel-4.0.2 {error: non-existent level} -setup {
+ interp create i
+} -body {
+ i eval { uplevel { set y 222 } }
+} -returnCodes error -result {bad level "1"} -cleanup {
+ interp delete i
+}
test uplevel-4.1 {error: non-existent level} {
list [catch c1 msg] $msg
} {1 {bad level "#2"}}
diff --git a/tests/upvar.test b/tests/upvar.test
index d18fd3b..f41fe1b 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -298,6 +298,17 @@ test upvar-8.3 {errors in upvar command} {
proc p1 {} {upvar a b c}
list [catch p1 msg] $msg
} {1 {wrong # args: should be "upvar ?level? otherVar localVar ?otherVar localVar ...?"}}
+test upvar-8.3.1 {bad level for upvar (upvar at top-level, bug [775ee88560])} -body {
+ proc p1 {} { uplevel { upvar b b; lappend b UNEXPECTED } }
+ uplevel #0 { p1 }
+} -returnCodes error -result {bad level "1"}
+test upvar-8.3.2 {bad level for upvar (upvar at top-level, bug [775ee88560])} -setup {
+ interp create i
+} -body {
+ i eval { upvar b b; lappend b UNEXPECTED }
+} -returnCodes error -result {bad level "1"} -cleanup {
+ interp delete i
+}
test upvar-8.4 {errors in upvar command} {
proc p1 {} {upvar 0 b b}
list [catch p1 msg] $msg