diff options
Diffstat (limited to 'tests/apply.test')
-rw-r--r-- | tests/apply.test | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/tests/apply.test b/tests/apply.test index 93c77a2..894aad3 100644 --- a/tests/apply.test +++ b/tests/apply.test @@ -12,10 +12,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: apply.test,v 1.10 2007/03/29 19:22:08 msofer Exp $ +# RCS: @(#) $Id: apply.test,v 1.11 2007/09/09 19:28:31 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { - package require tcltest + package require tcltest 2.2 namespace import -force ::tcltest::* } @@ -79,32 +79,26 @@ test apply-2.5 {malformed lambda} { # Tests for runtime errors in the lambda expression -test apply-3.1 {non-existing namespace} { - set lambda [list x {set x 1} ::NONEXIST::FOR::SURE] - set res [catch {apply $lambda x} msg] - list $res $msg -} {1 {cannot find namespace "::NONEXIST::FOR::SURE"}} -test apply-3.2 {non-existing namespace} { +test apply-3.1 {non-existing namespace} -body { + apply [list x {set x 1} ::NONEXIST::FOR::SURE] x +} -returnCodes error -result {namespace "::NONEXIST::FOR::SURE" not found} +test apply-3.2 {non-existing namespace} -body { namespace eval ::NONEXIST::FOR::SURE {} set lambda [list x {set x 1} ::NONEXIST::FOR::SURE] apply $lambda x namespace delete ::NONEXIST - set res [catch {apply $lambda x} msg] - list $res $msg -} {1 {cannot find namespace "::NONEXIST::FOR::SURE"}} -test apply-3.3 {non-existing namespace} { - set lambda [list x {set x 1} NONEXIST::FOR::SURE] - set res [catch {apply $lambda x} msg] - list $res $msg -} {1 {cannot find namespace "::NONEXIST::FOR::SURE"}} -test apply-3.4 {non-existing namespace} { + apply $lambda x +} -returnCodes error -result {namespace "::NONEXIST::FOR::SURE" not found} +test apply-3.3 {non-existing namespace} -body { + apply [list x {set x 1} NONEXIST::FOR::SURE] x +} -returnCodes error -result {namespace "::NONEXIST::FOR::SURE" not found} +test apply-3.4 {non-existing namespace} -body { namespace eval ::NONEXIST::FOR::SURE {} set lambda [list x {set x 1} NONEXIST::FOR::SURE] apply $lambda x namespace delete ::NONEXIST - set res [catch {apply $lambda x} msg] - list $res $msg -} {1 {cannot find namespace "::NONEXIST::FOR::SURE"}} + apply $lambda x +} -returnCodes error -result {namespace "::NONEXIST::FOR::SURE" not found} test apply-4.1 {error in arguments to lambda expression} { set lambda [list x {set x 1}] |