[Tclresource-commits] Extras/Tests AttributesCmd.test,1.1,1.2
Status: Beta
Brought to you by:
bdesgraupes
|
From: Bernard D. <bde...@us...> - 2004-09-06 22:16:57
|
Update of /cvsroot/tclresource/Extras/Tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv318 Modified Files: AttributesCmd.test Log Message: 7 tests Index: AttributesCmd.test =================================================================== RCS file: /cvsroot/tclresource/Extras/Tests/AttributesCmd.test,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AttributesCmd.test 6 Sep 2004 07:00:42 -0000 1.1 +++ AttributesCmd.test 6 Sep 2004 22:16:46 -0000 1.2 @@ -1,7 +1,7 @@ # ------------------------------------------------------- # File: "AttributesCmd.test" # Created: 2004-09-05 20:16:33 -# Last modification: 2004-09-05 10:49:55 +# Last modification: 2004-09-06 23:24:58 # Author: Bernard Desgraupes # e-mail: <bde...@ea...> # www: <http://webperso.easyconnect.fr/bdesgraupes/> @@ -19,26 +19,78 @@ source [file join [file dir [info script]] common.tcl] + namespace eval ::resource::test { namespace import ::tcltest::* + - test ResourceAttributes-1-1 {} -setup { + test ResourceAttributes-1-1 {Get attributes for read-only map} -setup { + set rid [resource open $resfileDF] } -body { + # Attributes should be 128 (mapReadOnly) since we opened + # with no specified permission (which defaults to "r") + set res [resource attributes $rid] } -cleanup { - } -result "" - - test ResourceAttributes-1-2 {} -setup { + resource close $rid + } -result 128 + + test ResourceAttributes-1-2 {Set mapChanged flag for map} -setup { + set rid [resource open $resfileDF] } -body { + resource attributes $rid 32 + set res [resource attributes $rid] } -cleanup { - } -result "" - - test ResourceAttributes-1-3 {} -setup { + resource close $rid + } -result 32 + + test ResourceAttributes-1-3 {Get attributes for read-write map} -setup { + set rid [resource open $resfileDF w] + } -body { + # Attributes should be 0 since we opened with "w" permission + set res [resource attributes $rid] + } -cleanup { + resource close $rid + } -result 0 + + test ResourceAttributes-1-4 {Get attributes for single resource} -setup { + set rid [resource open $resfileDF] } -body { + set res [resource attributes $rid -id 128 TEXT] + } -cleanup { + resource close $rid + } -result 0 + + test ResourceAttributes-1-5 {Set resLocked attr for res in RW map} -setup { + set rid [resource open $resfileDF w] + } -body { + # resLocked = 16 + set res [resource attributes $rid -id 128 TEXT 16] } -cleanup { + resource close $rid } -result "" - -# Cleanup -::tcltest::cleanupTests + + test ResourceAttributes-1-6 {Set resLocked attr for single resource} -setup { + set rid [resource open $resfileDF] + } -body { + # This should fail because the fork has been opened read-only + resource attributes $rid -id 128 TEXT 16 + } -cleanup { + resource close $rid + } -returnCodes error -match glob \ + -result "cannot set the attributes, resource map is read only" + + test ResourceAttributes-1-7 {Use non existing -id} -setup { + set rid [resource open $resfileDF] + } -body { + # Attributes should be 0 since we opened with "w" permission + set res [resource attributes $rid -id 1000 TEXT] + } -cleanup { + resource close $rid + } -returnCodes error -match glob \ + -result "resource not found" + + # Cleanup + ::tcltest::cleanupTests } namespace delete ::resource::test |