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