sl@0: # This file tests the tclWinFile.c file. sl@0: # sl@0: # This file contains a collection of tests for one or more of the Tcl sl@0: # built-in commands. Sourcing this file into Tcl runs the tests and sl@0: # generates output for errors. No output means no errors were found. sl@0: # sl@0: # Copyright (c) 1997 Sun Microsystems, Inc. sl@0: # Copyright (c) 1998-1999 by Scriptics Corporation. sl@0: # sl@0: # See the file "license.terms" for information on usage and redistribution sl@0: # of this file, and for a DISCLAIMER OF ALL WARRANTIES. sl@0: # sl@0: # RCS: @(#) $Id: winFile.test,v 1.9.2.1 2003/04/14 15:45:58 vincentdarley Exp $ sl@0: sl@0: if {[lsearch [namespace children] ::tcltest] == -1} { sl@0: package require tcltest sl@0: namespace import -force ::tcltest::* sl@0: } sl@0: sl@0: test winFile-1.1 {TclpGetUserHome} {pcOnly} { sl@0: list [catch {glob ~nosuchuser} msg] $msg sl@0: } {1 {user "nosuchuser" doesn't exist}} sl@0: test winFile-1.2 {TclpGetUserHome} {pcOnly nt nonPortable} { sl@0: # The administrator account should always exist. sl@0: sl@0: catch {glob ~administrator} sl@0: } {0} sl@0: test winFile-1.3 {TclpGetUserHome} {pcOnly 95} { sl@0: # Find some user in system.ini and then see if they have a home. sl@0: sl@0: set f [open $::env(windir)/system.ini] sl@0: set x 0 sl@0: while {![eof $f]} { sl@0: set line [gets $f] sl@0: if {$line == "\[Password Lists]"} { sl@0: gets $f sl@0: set name [lindex [split [gets $f] =] 0] sl@0: if {$name != ""} { sl@0: set x [catch {glob ~$name}] sl@0: break sl@0: } sl@0: } sl@0: } sl@0: close $f sl@0: set x sl@0: } {0} sl@0: test winFile-1.4 {TclpGetUserHome} {pcOnly nt nonPortable} { sl@0: catch {glob ~stanton@workgroup} sl@0: } {0} sl@0: sl@0: test winFile-2.1 {TclpMatchFiles: case sensitivity} {pcOnly} { sl@0: makeFile {} GlobCapS sl@0: set result [list [glob -nocomplain GlobC*] [glob -nocomplain globc*]] sl@0: removeFile GlobCapS sl@0: set result sl@0: } {GlobCapS GlobCapS} sl@0: sl@0: test winFile-2.2 {TclpMatchFiles: case sensitivity} {pcOnly} { sl@0: makeFile {} globlower sl@0: set result [list [glob -nocomplain globl*] [glob -nocomplain gLOBl*]] sl@0: removeFile globlower sl@0: set result sl@0: } {globlower globlower} sl@0: sl@0: test winFile-3.1 {file system} {pcOnly} { sl@0: set res "volume types ok" sl@0: foreach vol [file volumes] { sl@0: # Have to catch in case there is a removable drive (CDROM, floppy) sl@0: # with nothing in it. sl@0: catch { sl@0: if {![string equal [lindex [file system $vol] 1] [testvolumetype $vol]]} { sl@0: set res "For $vol, we found [file system $vol]\ sl@0: and [testvolumetype $vol] are different" sl@0: break sl@0: } sl@0: } sl@0: } sl@0: set res sl@0: } {volume types ok} sl@0: sl@0: # cleanup sl@0: ::tcltest::cleanupTests sl@0: return sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: sl@0: