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