Browse Source

runtests.tcl: pass project_root to tm_path_additional_ifneeded + fix modules_tcl copy-paste bug + zipper #modpod verification test

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
Julian Noble 2 weeks ago
parent
commit
4dc93b12b9
  1. 50
      src/tests/modules/zipper/testsuites/zipper/zipper.test
  2. 4
      src/tests/runtests.tcl

50
src/tests/modules/zipper/testsuites/zipper/zipper.test

@ -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
}

4
src/tests/runtests.tcl

@ -274,9 +274,9 @@ proc runtests_print_slowest_tests {slowest_tests show_timings} {
set test_tmlist [list] set test_tmlist [list]
set ifneeded_script "" set ifneeded_script ""
lappend test_tmlist [file normalize $test_base/../modules] ;#ie <projectroot>/src/modules lappend test_tmlist [file normalize $test_base/../modules] ;#ie <projectroot>/src/modules
append ifneeded_script [punk::tcltestrun::tm_path_additional_ifneeded [file normalize $test_base/../modules]] append ifneeded_script [punk::tcltestrun::tm_path_additional_ifneeded [file normalize $test_base/../modules] $project_root]
lappend test_tmlist [file normalize $test_base/../modules_tcl$tcl_major] lappend test_tmlist [file normalize $test_base/../modules_tcl$tcl_major]
append ifneeded_script [punk::tcltestrun::tm_path_additional_ifneeded [file normalize $test_base/../modules]] append ifneeded_script [punk::tcltestrun::tm_path_additional_ifneeded [file normalize $test_base/../modules_tcl$tcl_major] $project_root]
lappend test_tmlist [file normalize $test_base/../bootsupport/modules] lappend test_tmlist [file normalize $test_base/../bootsupport/modules]
#vendored module dependencies (e.g voo) must be resolvable by modules/tests using them #vendored module dependencies (e.g voo) must be resolvable by modules/tests using them
lappend test_tmlist [file normalize $test_base/../vendormodules] lappend test_tmlist [file normalize $test_base/../vendormodules]

Loading…
Cancel
Save