os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/unixFile.test
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 # This file contains tests for the routines in the file tclUnixFile.c
     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) 1998-1999 by Scriptics Corporation.
     8 # Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiaries. All rights reserved.  
     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: unixFile.test,v 1.7 2002/07/05 10:38:43 dkf Exp $
    14 
    15 if {[lsearch [namespace children] ::tcltest] == -1} {
    16     package require tcltest
    17     namespace import -force ::tcltest::*
    18 }
    19 
    20 if {[info commands testobj] == {}} {
    21     puts "This application hasn't been compiled with the \"testfindexecutable\""
    22     puts "command, so I can't test the Tcl_FindExecutable function"
    23     ::tcltest::cleanupTests
    24     return
    25 }
    26 
    27 set oldpwd [pwd]
    28 cd [temporaryDirectory]
    29 
    30 catch {
    31     set oldPath $env(PATH)
    32     file attributes [makeFile "" junk] -perm 0777
    33 }
    34 set absPath [file join [temporaryDirectory] junk]
    35 
    36 test unixFile-1.1 {Tcl_FindExecutable} {unixOnly tempNotSymbian} {
    37     set env(PATH) ""
    38     testfindexecutable junk
    39 } $absPath
    40 test unixFile-1.1.1 {Tcl_FindExecutable} {symbianOnly} {
    41     set env(PATH) ""
    42     testfindexecutable tcltest.exe
    43 } "Z:/sys/bin/tcltest.exe"
    44 test unixFile-1.1.2 {Tcl_FindExecutable} {symbianOnly} {
    45     set env(PATH) "Z:\\sys\\bin\\"
    46     testfindexecutable tcltest.exe
    47 } "Z:/sys/bin/tcltest.exe"
    48 
    49 test unixFile-1.2 {Tcl_FindExecutable} {unixOnly tempNotSymbian} {
    50     set env(PATH) "/dummy"
    51     testfindexecutable junk
    52 } {}
    53 test unixFile-1.3 {Tcl_FindExecutable} {unixOnly tempNotSymbian} {
    54     set env(PATH) "/dummy:[pwd]"
    55     testfindexecutable junk
    56 } $absPath
    57 test unixFile-1.4 {Tcl_FindExecutable} {unixOnly tempNotSymbian} {
    58     set env(PATH) "/dummy:"
    59     testfindexecutable junk
    60 } $absPath
    61 test unixFile-1.5 {Tcl_FindExecutable} {unixOnly tempNotSymbian} {
    62     set env(PATH) "/dummy:/dummy"
    63     testfindexecutable junk
    64 } {}
    65 test unixFile-1.6 {Tcl_FindExecutable} {unixOnly tempNotSymbian} {
    66     set env(PATH) "/dummy::/dummy"
    67     testfindexecutable junk
    68 } $absPath
    69 test unixFile-1.7 {Tcl_FindExecutable} {unixOnly tempNotSymbian} {
    70     set env(PATH) ":/dummy"
    71     testfindexecutable junk
    72 } $absPath
    73 
    74 # cleanup
    75 catch {set env(PATH) $oldPath}
    76 removeFile junk
    77 cd $oldpwd
    78 ::tcltest::cleanupTests
    79 return