13-zip.tcl at [081b7cf929]

File build/test/tests/13-zip.tcl artifact 549a9875dc part of check-in 081b7cf929


#! /usr/bin/env tclsh

# Abort if we cant read the tmpfile path from the environment
if {![info exists ::env(TMPFILE)]} {
	exit 0
}

# Abort this test if we don't have vfs::zip
if {[catch {
	package require vfs::zip
}]} {
	exit 0
}

set tmpfile $::env(TMPFILE)

vfs::zip::Mount $tmpfile $tmpfile

set fd [open [file join $tmpfile data]]
set data [read $fd]
close $fd

catch {
	vfs::unmount $tmpfile
}

catch {
	file delete -force -- $tmpfile
}

if {[string match "Hello World*" $data]} {
	exit 0
}

puts "Got \[0..10\]:    [string range $data 0 10]"
puts "Expected (match): Hello World*"

exit 1