sl@0
|
1 |
# This file tests the tclWinFile.c file.
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# This file contains a collection of tests for one or more of the Tcl
|
sl@0
|
4 |
# built-in commands. Sourcing this file into Tcl runs the tests and
|
sl@0
|
5 |
# generates output for errors. No output means no errors were found.
|
sl@0
|
6 |
#
|
sl@0
|
7 |
# Copyright (c) 1997 Sun Microsystems, Inc.
|
sl@0
|
8 |
# Copyright (c) 1998-1999 by Scriptics Corporation.
|
sl@0
|
9 |
#
|
sl@0
|
10 |
# See the file "license.terms" for information on usage and redistribution
|
sl@0
|
11 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
sl@0
|
12 |
#
|
sl@0
|
13 |
# RCS: @(#) $Id: winFile.test,v 1.9.2.1 2003/04/14 15:45:58 vincentdarley Exp $
|
sl@0
|
14 |
|
sl@0
|
15 |
if {[lsearch [namespace children] ::tcltest] == -1} {
|
sl@0
|
16 |
package require tcltest
|
sl@0
|
17 |
namespace import -force ::tcltest::*
|
sl@0
|
18 |
}
|
sl@0
|
19 |
|
sl@0
|
20 |
test winFile-1.1 {TclpGetUserHome} {pcOnly} {
|
sl@0
|
21 |
list [catch {glob ~nosuchuser} msg] $msg
|
sl@0
|
22 |
} {1 {user "nosuchuser" doesn't exist}}
|
sl@0
|
23 |
test winFile-1.2 {TclpGetUserHome} {pcOnly nt nonPortable} {
|
sl@0
|
24 |
# The administrator account should always exist.
|
sl@0
|
25 |
|
sl@0
|
26 |
catch {glob ~administrator}
|
sl@0
|
27 |
} {0}
|
sl@0
|
28 |
test winFile-1.3 {TclpGetUserHome} {pcOnly 95} {
|
sl@0
|
29 |
# Find some user in system.ini and then see if they have a home.
|
sl@0
|
30 |
|
sl@0
|
31 |
set f [open $::env(windir)/system.ini]
|
sl@0
|
32 |
set x 0
|
sl@0
|
33 |
while {![eof $f]} {
|
sl@0
|
34 |
set line [gets $f]
|
sl@0
|
35 |
if {$line == "\[Password Lists]"} {
|
sl@0
|
36 |
gets $f
|
sl@0
|
37 |
set name [lindex [split [gets $f] =] 0]
|
sl@0
|
38 |
if {$name != ""} {
|
sl@0
|
39 |
set x [catch {glob ~$name}]
|
sl@0
|
40 |
break
|
sl@0
|
41 |
}
|
sl@0
|
42 |
}
|
sl@0
|
43 |
}
|
sl@0
|
44 |
close $f
|
sl@0
|
45 |
set x
|
sl@0
|
46 |
} {0}
|
sl@0
|
47 |
test winFile-1.4 {TclpGetUserHome} {pcOnly nt nonPortable} {
|
sl@0
|
48 |
catch {glob ~stanton@workgroup}
|
sl@0
|
49 |
} {0}
|
sl@0
|
50 |
|
sl@0
|
51 |
test winFile-2.1 {TclpMatchFiles: case sensitivity} {pcOnly} {
|
sl@0
|
52 |
makeFile {} GlobCapS
|
sl@0
|
53 |
set result [list [glob -nocomplain GlobC*] [glob -nocomplain globc*]]
|
sl@0
|
54 |
removeFile GlobCapS
|
sl@0
|
55 |
set result
|
sl@0
|
56 |
} {GlobCapS GlobCapS}
|
sl@0
|
57 |
|
sl@0
|
58 |
test winFile-2.2 {TclpMatchFiles: case sensitivity} {pcOnly} {
|
sl@0
|
59 |
makeFile {} globlower
|
sl@0
|
60 |
set result [list [glob -nocomplain globl*] [glob -nocomplain gLOBl*]]
|
sl@0
|
61 |
removeFile globlower
|
sl@0
|
62 |
set result
|
sl@0
|
63 |
} {globlower globlower}
|
sl@0
|
64 |
|
sl@0
|
65 |
test winFile-3.1 {file system} {pcOnly} {
|
sl@0
|
66 |
set res "volume types ok"
|
sl@0
|
67 |
foreach vol [file volumes] {
|
sl@0
|
68 |
# Have to catch in case there is a removable drive (CDROM, floppy)
|
sl@0
|
69 |
# with nothing in it.
|
sl@0
|
70 |
catch {
|
sl@0
|
71 |
if {![string equal [lindex [file system $vol] 1] [testvolumetype $vol]]} {
|
sl@0
|
72 |
set res "For $vol, we found [file system $vol]\
|
sl@0
|
73 |
and [testvolumetype $vol] are different"
|
sl@0
|
74 |
break
|
sl@0
|
75 |
}
|
sl@0
|
76 |
}
|
sl@0
|
77 |
}
|
sl@0
|
78 |
set res
|
sl@0
|
79 |
} {volume types ok}
|
sl@0
|
80 |
|
sl@0
|
81 |
# cleanup
|
sl@0
|
82 |
::tcltest::cleanupTests
|
sl@0
|
83 |
return
|
sl@0
|
84 |
|
sl@0
|
85 |
|
sl@0
|
86 |
|
sl@0
|
87 |
|
sl@0
|
88 |
|
sl@0
|
89 |
|
sl@0
|
90 |
|
sl@0
|
91 |
|
sl@0
|
92 |
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
|