diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-09-14 16:30:02 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-09-14 16:30:02 (GMT) |
commit | 748f1c39e564df9766e43843cc48167342d39dc2 (patch) | |
tree | 206fdd141e193ca936d5ccd1e19a8d1e8c37cc68 | |
parent | 16905581a386e5438de74712dd90b45d1f7760b9 (diff) | |
download | tcl-748f1c39e564df9766e43843cc48167342d39dc2.zip tcl-748f1c39e564df9766e43843cc48167342d39dc2.tar.gz tcl-748f1c39e564df9766e43843cc48167342d39dc2.tar.bz2 |
Fix more arg count tests. Adapt stat dict for non-windows
-rw-r--r-- | generic/tclZipfs.c | 2 | ||||
-rw-r--r-- | tests/zipfs.test | 41 |
2 files changed, 23 insertions, 20 deletions
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c index 71d3c55..6ed23f7 100644 --- a/generic/tclZipfs.c +++ b/generic/tclZipfs.c @@ -3648,7 +3648,7 @@ ZipFSLMkImgObjCmd( Tcl_Obj *originFile, *password; if (objc < 3 || objc > 5) { - Tcl_WrongNumArgs(interp, 1, objv, "outfile inlist ?password infile?"); + Tcl_WrongNumArgs(interp, 1, objv, "outfile inlist ?password? ?infile?"); return TCL_ERROR; } if (Tcl_IsSafe(interp)) { diff --git a/tests/zipfs.test b/tests/zipfs.test index 3bbecb8..44228c7 100644 --- a/tests/zipfs.test +++ b/tests/zipfs.test @@ -90,19 +90,6 @@ test zipfs-0.12 {zipfs basics: join} -constraints {zipfs zipfslib} -body { file normalize ${ziproot}//bar/baz//qux/../ } -result "${ziproot}bar/baz" -test zipfs-1.5 {zipfs errors} -constraints zipfs -returnCodes error -body { - zipfs mkkey a b c d e f -} -result {wrong # args: should be "zipfs mkkey password"} -test zipfs-1.6 {zipfs errors} -constraints zipfs -returnCodes error -body { - zipfs mkimg a b c d e f -} -result {wrong # args: should be "zipfs mkimg outfile indir ?strip? ?password? ?infile?"} -test zipfs-1.7 {zipfs errors} -constraints zipfs -returnCodes error -body { - zipfs mkzip a b c d e f -} -result {wrong # args: should be "zipfs mkzip outfile indir ?strip? ?password?"} -test zipfs-1.9 {zipfs errors} -constraints zipfs -returnCodes error -body { - zipfs info a b c d e f -} -result {wrong # args: should be "zipfs info filename"} - file mkdir tmp test zipfs-2.1 {zipfs mkzip empty archive} -constraints zipfs -returnCodes error -body { zipfs mkzip [file join $tmpdir empty.zip] $tcl_library/xxxx @@ -958,14 +945,22 @@ namespace eval test_ns_zipfs { testuncompress bzip2 testbzip2.zip {unsupported compression method} -returnCodes error testuncompress lzma testfile-lzma.zip {unsupported compression method} -returnCodes error testuncompress xz testfile-xz.zip {unsupported compression method} -returnCodes error + testuncompress zstd testfile-zstd.zip {unsupported compression method} -returnCodes error # # file stat + proc fixupstat {stat} { + if {$::tcl_platform(platform) ne "windows"} { + dict set stat blksize 0 + dict set stat blocks 0 + } + return [lsort -stride 2 $stat] + } test zipfs-file-stat-nosuchfile "Read stat of nonexistent file" -setup { mount [zippath test.zip] } -cleanup cleanup -body { file stat [file join $defaultMountPoint nosuchfile] - } -result "could not read \"[file join $defaultMountPoint nosuchfile]\": no such file or directory" -returnCodes error + } -result "could not read \"[file join $defaultMountPoint nosuchfile]\": *" -match glob -returnCodes error test zipfs-file-stat-nosuchmount "Read stat of nonexistent mount" -body { file stat [file join $defaultMountPoint nosuchfile] @@ -975,31 +970,31 @@ namespace eval test_ns_zipfs { mount [zippath test.zip] } -cleanup cleanup -body { lsort -stride 2 [file stat [file join $defaultMountPoint test]] - } -result {atime 1065435402 ctime 1065435402 dev 0 gid 0 ino 0 mode 33133 mtime 1065435402 nlink 0 size 5 type file uid 0} + } -result [fixupstat {atime 1065435402 ctime 1065435402 dev 0 gid 0 ino 0 mode 33133 mtime 1065435402 nlink 0 size 5 type file uid 0}] test zipfs-file-stat-dir "Read stat of dir" -setup { mount [zippath test.zip] } -cleanup cleanup -body { lsort -stride 2 [file stat [file join $defaultMountPoint testdir]] - } -result {atime 1105450434 ctime 1105450434 dev 0 gid 0 ino 0 mode 16749 mtime 1105450434 nlink 0 size 0 type directory uid 0} + } -result [fixupstat {atime 1105450434 ctime 1105450434 dev 0 gid 0 ino 0 mode 16749 mtime 1105450434 nlink 0 size 0 type directory uid 0}] test zipfs-file-stat-mount "Read stat of mount point" -setup { mount [zippath test.zip] } -cleanup cleanup -body { lsort -stride 2 [file stat $defaultMountPoint] - } -result {atime 0 ctime 0 dev 0 gid 0 ino 0 mode 16749 mtime 0 nlink 0 size 0 type directory uid 0} + } -result [fixupstat {atime 0 ctime 0 dev 0 gid 0 ino 0 mode 16749 mtime 0 nlink 0 size 0 type directory uid 0}] test zipfs-file-stat-root-mount "Read stat of root" -setup { mount [zippath test.zip] [zipfs root] } -cleanup cleanup -body { lsort -stride 2 [file stat [zipfs root]] - } -result {atime 0 ctime 0 dev 0 gid 0 ino 0 mode 16749 mtime 0 nlink 0 size 0 type directory uid 0} + } -result [fixupstat {atime 0 ctime 0 dev 0 gid 0 ino 0 mode 16749 mtime 0 nlink 0 size 0 type directory uid 0}] test zipfs-file-stat-root-subdir-mount "Read stat of root when mount is subdir" -setup { mount [zippath test.zip] } -cleanup cleanup -constraints knownBug -body { lsort -stride 2 [file stat [zipfs root]] - } -result {atime 0 ctime 0 dev 0 gid 0 ino 0 mode 16749 mtime 0 nlink 0 size 0 type directory uid 0} + } -result [fixupstat {atime 0 ctime 0 dev 0 gid 0 ino 0 mode 16749 mtime 0 nlink 0 size 0 type directory uid 0}] # # TODO - glob of zipfs file @@ -1009,6 +1004,14 @@ namespace eval test_ns_zipfs { # # TODO - file copy, file rename etc. + + # TODO - mkkey, mkimg, mkzip, lmkimg, lmkzip + testnumargs "zipfs mkkey" "password" "" -constraints zipfs + testnumargs "zipfs mkimg" "outfile indir" "?strip? ?password? ?infile?" + testnumargs "zipfs lmkimg" "outfile inlist" "?password? ?infile?" + testnumargs "zipfs mkzip" "outfile indir" "?strip? ?password?" + testnumargs "zipfs lmkzip" "outfile inlist" "?password?" + # # Bug regressions |