summaryrefslogtreecommitdiffstats
path: root/tests/macOSXFCmd.test
diff options
context:
space:
mode:
authordas <das>2006-03-21 11:06:20 (GMT)
committerdas <das>2006-03-21 11:06:20 (GMT)
commitd4070e928ea23c067c492b5e594d206a76d9b3d5 (patch)
tree9b31284ec3cc00460868746481c7082902a886a4 /tests/macOSXFCmd.test
parentd13045d5f4f8b28861b4c1af3c4ceaa21331c173 (diff)
downloadtcl-d4070e928ea23c067c492b5e594d206a76d9b3d5.zip
tcl-d4070e928ea23c067c492b5e594d206a76d9b3d5.tar.gz
tcl-d4070e928ea23c067c492b5e594d206a76d9b3d5.tar.bz2
* generic/tclInt.decls: implement globbing for HFS creator & type
* macosx/tclMacOSXFCmd.c: codes and 'hidden' flag, as documented in * tests/macOSXFCmd.test: glob.n; objectified OSType handling in [glob] * unix/tclUnixFile.c: and [file attributes]; fix globbing for hidden files with pattern==NULL arg. [Bug 823329] * generic/tclIntPlatDecls.h: * generic/tclStubInit.c: make genstubs
Diffstat (limited to 'tests/macOSXFCmd.test')
-rw-r--r--tests/macOSXFCmd.test58
1 files changed, 50 insertions, 8 deletions
diff --git a/tests/macOSXFCmd.test b/tests/macOSXFCmd.test
index 2250435..b5f77c5 100644
--- a/tests/macOSXFCmd.test
+++ b/tests/macOSXFCmd.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: macOSXFCmd.test,v 1.2 2004/05/19 20:15:32 dkf Exp $
+# RCS: @(#) $Id: macOSXFCmd.test,v 1.3 2006/03/21 11:06:23 das Exp $
#
if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -66,15 +66,15 @@ test macOSXFCmd-1.5 {MacOSXGetFileAttribute - rsrclength} {macosxFileAttr notRoo
test macOSXFCmd-2.1 {MacOSXSetFileAttribute - file not found} {macosxFileAttr notRoot} {
catch {file delete -force -- foo.test}
- list [catch {file attributes foo.test -creator FOOO} msg] $msg
+ list [catch {file attributes foo.test -creator FOOC} msg] $msg
} {1 {could not read "foo.test": no such file or directory}}
test macOSXFCmd-2.2 {MacOSXSetFileAttribute - creator} {macosxFileAttr notRoot} {
catch {file delete -force -- foo.test}
close [open foo.test w]
- list [catch {file attributes foo.test -creator FOOO} msg] $msg \
+ list [catch {file attributes foo.test -creator FOOC} msg] $msg \
[catch {file attributes foo.test -creator} msg] $msg \
[file delete -force -- foo.test]
-} {0 {} 0 FOOO {}}
+} {0 {} 0 FOOC {}}
test macOSXFCmd-2.3 {MacOSXSetFileAttribute - empty creator} {macosxFileAttr notRoot} {
catch {file delete -force -- foo.test}
close [open foo.test w]
@@ -85,10 +85,10 @@ test macOSXFCmd-2.3 {MacOSXSetFileAttribute - empty creator} {macosxFileAttr not
test macOSXFCmd-2.4 {MacOSXSetFileAttribute - type} {macosxFileAttr notRoot} {
catch {file delete -force -- foo.test}
close [open foo.test w]
- list [catch {file attributes foo.test -type FOOO} msg] $msg \
+ list [catch {file attributes foo.test -type FOOT} msg] $msg \
[catch {file attributes foo.test -type} msg] $msg \
[file delete -force -- foo.test]
-} {0 {} 0 FOOO {}}
+} {0 {} 0 FOOT {}}
test macOSXFCmd-2.5 {MacOSXSetFileAttribute - empty type} {macosxFileAttr notRoot} {
catch {file delete -force -- foo.test}
close [open foo.test w]
@@ -123,7 +123,7 @@ test macOSXFCmd-3.1 {MacOSXCopyFileAttributes} {macosxFileAttr notRoot} {
catch {file delete -force -- bar.test}
close [open foo.test w]
catch {
- file attributes foo.test -creator FOOO -type FOOO -hidden 1
+ file attributes foo.test -creator FOOC -type FOOT -hidden 1
set f [open foo.test/rsrc w]
fconfigure $f -translation lf -eofchar {}
puts -nonewline $f "foo"
@@ -135,7 +135,49 @@ test macOSXFCmd-3.1 {MacOSXCopyFileAttributes} {macosxFileAttr notRoot} {
[catch {file attributes bar.test -hidden} msg] $msg \
[catch {file attributes bar.test -rsrclength} msg] $msg \
[file delete -force -- foo.test bar.test]
-} {0 FOOO 0 FOOO 0 1 0 3 {}}
+} {0 FOOC 0 FOOT 0 1 0 3 {}}
+
+test macOSXFCmd-4.1 {TclMacOSXMatchType} {macosxFileAttr notRoot} {
+ file mkdir globtest
+ cd globtest
+ foreach f {bar baz foo inv inw .nv reg} {
+ catch {file delete -force -- $f.test}
+ close [open $f.test w]
+ }
+ catch {file delete -force -- dir.test}
+ file mkdir dir.test
+ catch {
+ file attributes bar.test -type FOOT
+ file attributes baz.test -creator FOOC -type FOOT
+ file attributes foo.test -creator FOOC
+ file attributes inv.test -hidden 1
+ file attributes inw.test -hidden 1 -type FOOT
+ file attributes dir.test -hidden 1
+ }
+ set res [list \
+ [catch {glob *.test} msg] $msg \
+ [catch {glob -types FOOT *.test} msg] $msg \
+ [catch {glob -types {{macintosh type FOOT}} *.test} msg] $msg \
+ [catch {glob -types FOOTT *.test} msg] $msg \
+ [catch {glob -types {{macintosh type FOOTT}} *.test} msg] $msg \
+ [catch {glob -types {{macintosh type {}}} *.test} msg] $msg \
+ [catch {glob -types {{macintosh creator FOOC}} *.test} msg] $msg \
+ [catch {glob -types {{macintosh creator FOOC} {macintosh type FOOT}} *.test} msg] $msg \
+ [catch {glob -types hidden *.test} msg] $msg \
+ [catch {glob -types {hidden FOOT} *.test} msg] $msg \
+ ]
+ cd ..
+ file delete -force globtest
+ set res
+} [list \
+ 0 {bar.test baz.test dir.test foo.test inv.test inw.test reg.test} \
+ 0 {bar.test baz.test inw.test} 0 {bar.test baz.test inw.test} \
+ 1 {bad argument to "-types": FOOTT} \
+ 1 {expected Macintosh OS type but got "FOOTT": } \
+ 0 {foo.test inv.test reg.test} 0 {baz.test foo.test} \
+ 0 baz.test 0 {.nv.test dir.test inv.test inw.test} \
+ 0 inw.test
+]
# cleanup
cd $oldcwd