Browse Source
Both tm_path_additional_ifneeded call sites now pass \ as required by the 0.3.0 API. The second call site also passed the wrong path (../modules instead of ../modules_tcl\) due to a copy-paste bug, so Tcl-major-specific #modpod modules were never scanned. Added a zipper #modpod verification test that confirms package require zipper resolves to the 999999.0a1.0 #modpod version via the ifneeded mechanism and that initialize/addentry/finalize work correctly. All 4 tests pass under tclsh90.master
2 changed files with 52 additions and 2 deletions
@ -0,0 +1,50 @@ |
|||||||
|
package require tcltest |
||||||
|
package require zipper |
||||||
|
|
||||||
|
namespace eval ::testspace { |
||||||
|
namespace import ::tcltest::* |
||||||
|
|
||||||
|
test zipper_version { |
||||||
|
package require zipper resolves the unbuilt #modpod source version (999999.0a1.0) via the ifneeded mechanism |
||||||
|
} -body { |
||||||
|
package require zipper |
||||||
|
package provide zipper |
||||||
|
} -result {999999.0a1.0} |
||||||
|
|
||||||
|
test zipper_initialize { |
||||||
|
zipper::initialize sets up internal state on a writable channel |
||||||
|
} -body { |
||||||
|
set fd [file tempfile] |
||||||
|
chan configure $fd -translation binary -encoding iso8859-1 |
||||||
|
zipper::initialize $fd |
||||||
|
return [tell $fd] |
||||||
|
} -result {0} |
||||||
|
|
||||||
|
test zipper_addentry { |
||||||
|
zipper::addentry writes a local file header and entry data without error |
||||||
|
} -body { |
||||||
|
set fd [file tempfile] |
||||||
|
chan configure $fd -translation binary -encoding iso8859-1 |
||||||
|
zipper::initialize $fd |
||||||
|
zipper::addentry hello.txt "Hello, zipper!" [clock seconds] |
||||||
|
return [string length "Hello, zipper!"] |
||||||
|
} -result {14} |
||||||
|
|
||||||
|
test zipper_finalize { |
||||||
|
zipper::finalize emits the central directory and EOCD record and returns the channel |
||||||
|
} -body { |
||||||
|
set fd [file tempfile] |
||||||
|
chan configure $fd -translation binary -encoding iso8859-1 |
||||||
|
zipper::initialize $fd |
||||||
|
zipper::addentry a.txt "aaa" [clock seconds] |
||||||
|
zipper::addentry b.txt "bbb" [clock seconds] |
||||||
|
set fd2 [zipper::finalize] |
||||||
|
set size [tell $fd2] |
||||||
|
close $fd2 |
||||||
|
# A zip with two tiny entries should have a central directory and EOCD (>= PK signatures) |
||||||
|
# Minimum plausible size: 2 local headers + 2 CDR entries + EOCD = well over 100 bytes |
||||||
|
expr {$size > 100} |
||||||
|
} -result {1} |
||||||
|
|
||||||
|
cleanupTests |
||||||
|
} |
||||||
Loading…
Reference in new issue