[Tclresource-commits] Extras/Tests CloseCmd.test,1.1,1.2 DeleteCmd.test,1.4,1.5 WriteCmd.test,1.4,1.
Status: Beta
Brought to you by:
bdesgraupes
From: Bernard D. <bde...@us...> - 2004-09-07 07:23:55
|
Update of /cvsroot/tclresource/Extras/Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23214 Modified Files: CloseCmd.test DeleteCmd.test WriteCmd.test Log Message: Fixes for tclsh Index: DeleteCmd.test =================================================================== RCS file: /cvsroot/tclresource/Extras/Tests/DeleteCmd.test,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- DeleteCmd.test 7 Sep 2004 05:57:13 -0000 1.4 +++ DeleteCmd.test 7 Sep 2004 07:23:45 -0000 1.5 @@ -92,6 +92,7 @@ test ResourceDelete-1-8 {Delete resource in read-only map} -setup $SETUP -body { resource write -id 128 -name "Hello1" -file $rid TEXT "Hello1" + resource close $rid # Reopen read-only set rid [resource open $fname r] resource delete -id 128 -file $rid TEXT Index: WriteCmd.test =================================================================== RCS file: /cvsroot/tclresource/Extras/Tests/WriteCmd.test,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- WriteCmd.test 7 Sep 2004 05:18:35 -0000 1.4 +++ WriteCmd.test 7 Sep 2004 07:23:45 -0000 1.5 @@ -51,11 +51,18 @@ test ResourceWrite-1-4 {Omit the -file option, no fork opened} -setup { } -body { - # Since no resource fork has been opened, this will generate an error - resource write TEXT "Hello Tclresource!" + # Since no resource fork has been opened, the command attemps to + # write to the currently active res file. This may or may not + # generate an error. + set res "" + if {[catch {resource write TEXT "Hello Tclresource!"} res]} { + if {[string match $res "error adding resource to resource map"]} { + set res "" + } + } + set res } -cleanup { - } -returnCodes error \ - -result "error adding resource to resource map error releasing resource" + } -returnCodes [list error ok] -result "" test ResourceWrite-1-5 {Omit the -file option, fork opened} -setup $SETUP -body { # If a resource fork is open, this will write therein Index: CloseCmd.test =================================================================== RCS file: /cvsroot/tclresource/Extras/Tests/CloseCmd.test,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- CloseCmd.test 6 Sep 2004 07:01:06 -0000 1.1 +++ CloseCmd.test 7 Sep 2004 07:23:45 -0000 1.2 @@ -1,7 +1,7 @@ # ------------------------------------------------------- # File: "CloseCmd.test" # Created: 2004-09-05 20:16:33 -# Last modification: 2004-09-05 10:49:55 +# Last modification: 2004-09-07 08:45:31 # Author: Bernard Desgraupes # e-mail: <bde...@ea...> # www: <http://webperso.easyconnect.fr/bdesgraupes/> @@ -31,10 +31,18 @@ test ResourceClose-1-2 {Closing self is forbidden} -setup { } -body { - catch {resource close application} res + # Make sure "application" exists + if {[lsearch -exact [resource files] "application"] == -1} { + set res "" + } else { + catch {resource close application} res + if {[string match $res "not allowed to close \"application\" resource file"]} { + set res "" + } + } set res } -cleanup { - } -result "not allowed to close \"application\" resource file" + } -result "" test ResourceClose-1-3 {Close a non existing fork is an error} -setup { } -body { |