summaryrefslogtreecommitdiffstats
path: root/tests/error.test
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/error.test
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/error.test')
-rw-r--r--tests/error.test38
1 files changed, 19 insertions, 19 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