summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2011-04-04 13:40:01 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2011-04-04 13:40:01 (GMT)
commit25e4dca4916e5ae7be29bb21c40e59f3adb4b5ec (patch)
treeeebeebaa58948935075500c432b9c53885fe1d6b /tests
parent2205a28b9e00ec29977d2b21e2f2bda3b77aaaf4 (diff)
downloadtcl-25e4dca4916e5ae7be29bb21c40e59f3adb4b5ec.zip
tcl-25e4dca4916e5ae7be29bb21c40e59f3adb4b5ec.tar.gz
tcl-25e4dca4916e5ae7be29bb21c40e59f3adb4b5ec.tar.bz2
Better error-message in case of errors related to setting a variable
Diffstat (limited to 'tests')
-rw-r--r--tests/error.test38
-rw-r--r--tests/info.test6
-rw-r--r--tests/scan.test14
3 files changed, 29 insertions, 29 deletions
diff --git a/tests/error.test b/tests/error.test
index c34ccb0..97bcc0a 100644
--- a/tests/error.test
+++ b/tests/error.test
@@ -138,7 +138,7 @@ test error-3.3 {errors in catch command} {
catch {unset a}
set a(0) 22
list [catch {catch {format 44} a} msg] $msg
-} {1 {couldn't save command result in variable}}
+} {1 {can't set "a": variable is array}}
catch {unset a}
# More tests related to errorInfo and errorCode
@@ -417,7 +417,7 @@ test error-12.4 {try with result/opts variable assignment in on handler} {
} {bar,FOO}
test error-12.5 {try with result/opts variable assignment in on handler, vars remain in scope} {
try { throw FOO bar } on error {res opts} { list d e f }
- set r "$res,[dict get $opts -errorcode]"
+ set r "$res,[dict get $opts -errorcode]"
} {bar,FOO}
test error-12.6 {try result is propagated if no matching handler} {
try { list a b c } on error {} { list d e f }
@@ -459,7 +459,7 @@ test error-13.8 {try with multiple handlers and finally (ok)} {
try list on error {} {} trap {} {} {} finally {}
} {}
test error-13.9 {last handler body can't be a fallthrough #1} -body {
- try list on error {} {} on break {} -
+ try list on error {} {} on break {} -
} -returnCodes error -result {last non-finally clause must not have a body of "-"}
test error-13.10 {last handler body can't be a fallthrough #2} -body {
try list on error {} {} on break {} - finally { list d e f }
@@ -471,7 +471,7 @@ test error-14.1 {try with multiple handlers (only one matches) #1} {
try { throw FOO bar } on ok {} { list a b c } trap FOO {} { list d e f }
} {d e f}
test error-14.2 {try with multiple handlers (only one matches) #2} {
- try { throw FOO bar } trap FOO {} { list d e f } on ok {} { list a b c }
+ try { throw FOO bar } trap FOO {} { list d e f } on ok {} { list a b c }
} {d e f}
test error-14.3 {try with multiple handlers (only one matches) #3} {
try {
@@ -482,7 +482,7 @@ test error-14.3 {try with multiple handlers (only one matches) #3} {
list d e f
} on ok {} {
list a b c
- }
+ }
} {d e f}
test error-14.4 {try with multiple matching handlers (only the first in left-to-right order runs) #1} {
try { throw FOO bar } on error {} { list a b c } trap FOO {} { list d e f }
@@ -593,16 +593,16 @@ test error-16.6 {try with variable assignment and propagation #1} {
catch {
try { throw FOO bar } trap FOO {em} { throw BAR baz }
}
- set em
+ set em
} {bar}
test error-16.7 {try with variable assignment and propagation #2} {
catch {
try { throw FOO bar } trap FOO {em opts} { throw BAR baz }
}
- list $em [dict get $opts -errorcode]
+ list $em [dict get $opts -errorcode]
} {bar FOO}
test error-16.8 {exception chaining (try=ok, handler=error)} {
- #FIXME is the intent of this test correct?
+ #FIXME is the intent of this test correct?
catch {
try { list a b c } on ok {em opts} { throw BAR baz }
} tryem tryopts
@@ -686,7 +686,7 @@ test error-17.11 {successful finally doesn't affect variable assignment or propa
catch {
try { throw FOO bar } trap FOO {em opts} { throw BAR baz } finally { list d e f }
}
- list $em [dict get $opts -errorcode]
+ list $em [dict get $opts -errorcode]
} {bar FOO}
# try tests - propagation (exceptions in finally, exception chaining)
@@ -707,11 +707,11 @@ test error-18.5 {exception in finally doesn't affect variable assignment} {
catch {
try { throw FOO bar } trap FOO {em opts} { throw BAR baz } finally { throw BAZ zing }
}
- list $em [dict get $opts -errorcode]
+ list $em [dict get $opts -errorcode]
} {bar FOO}
test error-18.6 {exception chaining in finally (try=ok)} {
catch {
- list a b c
+ list a b c
} em expopts
catch {
try { list a b c } finally { throw BAR foo }
@@ -782,14 +782,14 @@ test error-19.1 {try with fallthrough body #1} {
} {1}
test error-19.2 {try with fallthrough body #2} {
set RES {}
- try {
- throw FOO bar
+ try {
+ throw FOO bar
} trap BAR {} {
} trap FOO {} - trap {} {} {
set RES foo
} on error {} {
set RES err
- }
+ }
set RES
} {foo}
test error-19.3 {try with cascade fallthrough} {
@@ -805,22 +805,22 @@ test error-19.4 {multiple unrelated fallthroughs #1} {
set RES {}
try {
throw FOO bar
- } trap FOO {} - trap BAR {} {
+ } trap FOO {} - trap BAR {} {
set RES foo
} trap {} {} - on error {} {
set RES err
- }
+ }
set RES
} {foo}
test error-19.5 {multiple unrelated fallthroughs #2} {
set RES {}
try {
throw BAZ zing
- } trap FOO {} - trap BAR {} {
+ } trap FOO {} - trap BAR {} {
set RES foo
} trap {} {} - on error {} {
set RES err
- }
+ }
set RES
} {err}
proc addmsg msg {
@@ -1054,7 +1054,7 @@ namespace delete ::tcl::test::error
# cleanup
catch {rename p ""}
::tcltest::cleanupTests
-return
+return
# Local Variables:
# mode: tcl
diff --git a/tests/info.test b/tests/info.test
index 9977054..3323281 100644
--- a/tests/info.test
+++ b/tests/info.test
@@ -215,14 +215,14 @@ test info-6.9 {info default option} -returnCodes error -setup {
set a(0) 88
proc t1 {a b} {}
info default t1 a a
-} -returnCodes error -result {couldn't store default value in variable "a"}
+} -returnCodes error -result {can't set "a": variable is array}
test info-6.10 {info default option} -setup {
catch {unset a}
} -cleanup {unset a} -body {
set a(0) 88
proc t1 {{a 18} b} {}
info default t1 a a
-} -returnCodes error -result {couldn't store default value in variable "a"}
+} -returnCodes error -result {can't set "a": variable is array}
test info-6.11 {info default option} {
catch {namespace delete test_ns_info2}
namespace eval test_ns_info2 {
@@ -1826,7 +1826,7 @@ test info-30.46 {TIP 280 for compiled [subst]} {
} YES
test info-30.47 {TIP 280 for compiled [subst]} {
unset -nocomplain a
- set a(\n1831) YES; set a(\n1830) 1830; set a(\n1832) 1832
+ set a(\n1831) YES; set a(\n1830) 1830; set a(\n1832) 1832
subst {$a(
[dict get [info frame 0] line])} ; # 1831
} YES
diff --git a/tests/scan.test b/tests/scan.test
index 6e1ccb0..84f22b4 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -328,7 +328,7 @@ test scan-4.60 {Tcl_ScanObjCmd, set errors} {
$msg $x $y]
unset z
set result
-} {1 {couldn't set variable "z"} abc ghi}
+} {1 {can't set "z": variable is array} abc ghi}
test scan-4.61 {Tcl_ScanObjCmd, set errors} {
set x {}
catch {unset y}; array set y {}
@@ -338,7 +338,7 @@ test scan-4.61 {Tcl_ScanObjCmd, set errors} {
unset y
unset z
set result
-} {1 {couldn't set variable "z"couldn't set variable "y"} abc}
+} {1 {can't set "z": variable is array} abc}
# procedure that returns the range of integers
@@ -545,27 +545,27 @@ test scan-8.12 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %d a} msg] $msg
-} {1 {couldn't set variable "a"}}
+} {1 {can't set "a": variable is array}}
test scan-8.13 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %c a} msg] $msg
-} {1 {couldn't set variable "a"}}
+} {1 {can't set "a": variable is array}}
test scan-8.14 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %s a} msg] $msg
-} {1 {couldn't set variable "a"}}
+} {1 {can't set "a": variable is array}}
test scan-8.15 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %f a} msg] $msg
-} {1 {couldn't set variable "a"}}
+} {1 {can't set "a": variable is array}}
test scan-8.16 {error conditions} {
catch {unset a}
set a(0) 44
list [catch {scan 44 %f a} msg] $msg
-} {1 {couldn't set variable "a"}}
+} {1 {can't set "a": variable is array}}
catch {unset a}
test scan-8.17 {error conditions} {
list [catch {scan 44 %2c a} msg] $msg