summaryrefslogtreecommitdiffstats
path: root/tests/zipfs.test
diff options
context:
space:
mode:
authorhypnotoad <yoda@etoyoc.com>2018-01-17 15:56:32 (GMT)
committerhypnotoad <yoda@etoyoc.com>2018-01-17 15:56:32 (GMT)
commit608373fcb170fe76512b46c7ce07cc0691720ae5 (patch)
tree24ec4713d027b78db96a2b9c2d144cedd5f25a1c /tests/zipfs.test
parenta866c42f19f6a9824006d8113367245c7df75b01 (diff)
downloadtcl-608373fcb170fe76512b46c7ce07cc0691720ae5.zip
tcl-608373fcb170fe76512b46c7ce07cc0691720ae5.tar.gz
tcl-608373fcb170fe76512b46c7ce07cc0691720ae5.tar.bz2
Modifications to allow the mounting of zip file systems from data blocks
Added a new stubs entry to mount a data block as a zip file system
Diffstat (limited to 'tests/zipfs.test')
-rw-r--r--tests/zipfs.test73
1 files changed, 68 insertions, 5 deletions
diff --git a/tests/zipfs.test b/tests/zipfs.test
index 060e4a6..5f5b93c 100644
--- a/tests/zipfs.test
+++ b/tests/zipfs.test
@@ -105,7 +105,7 @@ test zipfs-0.12 {zipfs basics: join} -constraints zipfs -body {
test zipfs-1.3 {zipfs errors} -constraints zipfs -returnCodes error -body {
zipfs mount a b c d e f
-} -result {wrong # args: should be "zipfs mount ?zipfile? ?mountpoint? ?password?"}
+} -result {wrong # args: should be "zipfs mount ?mountpoint? ?zipfile? ?password?"}
test zipfs-1.4 {zipfs errors} -constraints zipfs -returnCodes error -body {
zipfs unmount a b c d e f
@@ -159,11 +159,8 @@ test zipfs-2.2.0 {zipfs mkzip} -constraints zipfs -body {
cd $CWD
} -result "[zipfs root]abc/cp850.enc"
-skip [concat [skip] zipfs-2.2.*]
-
-
if {![zipfs exists /abc/cp850.enc]} {
- tcltest::skip zipfs-2.2.*
+ skip [concat [skip] zipfs-2.2.*]
}
test zipfs-2.2.1 {zipfs info} -constraints zipfs -body {
@@ -210,7 +207,73 @@ test zipfs-2.2.6 {zipfs unmount} -constraints zipfs -body {
zipfs exists /abc/cp850.enc
} -result 0
+
+###
+# Repeat the tests for a buffer mounted archive
+###
+test zipfs-2.3.0 {zipfs mkzip} -constraints zipfs -body {
+ cd $tcl_library/encoding
+ zipfs mkzip $zipfile .
+ set fin [open $zipfile r]
+ fconfigure $fin -translation binary
+ set dat [read $fin]
+ close $fin
+ zipfs mount_data def $dat
+ zipfs list -glob ${ziproot}def/cp850.*
+} -cleanup {
+ cd $CWD
+} -result "[zipfs root]def/cp850.enc"
+
+if {![zipfs exists /def/cp850.enc]} {
+ skip [concat [skip] zipfs-2.3.*]
+}
+
+test zipfs-2.3.1 {zipfs info} -constraints zipfs -body {
+ set r [zipfs info ${ziproot}def/cp850.enc]
+ lrange $r 0 2
+} -result [list {Memory Buffer} 1090 527] ;# NOTE: Only the first 3 results are stable
+
+test zipfs-2.3.3 {zipfs data} -constraints zipfs -body {
+ set zipfd [open ${ziproot}/def/cp850.enc] ;# FIXME: leave open - see later test
+ read $zipfd
+} -result {# Encoding file: cp850, single-byte
+S
+003F 0 1
+00
+0000000100020003000400050006000700080009000A000B000C000D000E000F
+0010001100120013001400150016001700180019001A001B001C001D001E001F
+0020002100220023002400250026002700280029002A002B002C002D002E002F
+0030003100320033003400350036003700380039003A003B003C003D003E003F
+0040004100420043004400450046004700480049004A004B004C004D004E004F
+0050005100520053005400550056005700580059005A005B005C005D005E005F
+0060006100620063006400650066006700680069006A006B006C006D006E006F
+0070007100720073007400750076007700780079007A007B007C007D007E007F
+00C700FC00E900E200E400E000E500E700EA00EB00E800EF00EE00EC00C400C5
+00C900E600C600F400F600F200FB00F900FF00D600DC00F800A300D800D70192
+00E100ED00F300FA00F100D100AA00BA00BF00AE00AC00BD00BC00A100AB00BB
+2591259225932502252400C100C200C000A9256325512557255D00A200A52510
+25142534252C251C2500253C00E300C3255A25542569256625602550256C00A4
+00F000D000CA00CB00C8013100CD00CE00CF2518250C2588258400A600CC2580
+00D300DF00D400D200F500D500B500FE00DE00DA00DB00D900FD00DD00AF00B4
+00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0
+} ;# FIXME: result depends on content of encodings dir
+
+test zipfs-2.3.4 {zipfs exists} -constraints zipfs -body {
+ zipfs exists /def/cp850.enc
+} -result 1
+
+test zipfs-2.3.5 {zipfs unmount while busy} -constraints zipfs -body {
+ zipfs unmount /def
+} -returnCodes error -result {filesystem is busy}
+
+test zipfs-2.3.6 {zipfs unmount} -constraints zipfs -body {
+ close $zipfd
+ zipfs unmount /def
+ zipfs exists /def/cp850.enc
+} -result 0
+
catch {file delete -force $tmpdir}
+
::tcltest::cleanupTests
return