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 © 1998-1999 Scriptics Corporation. 8# 9# See the file "license.terms" for information on usage and redistribution 10# of this file, and for a DISCLAIMER OF ALL WARRANTIES. 11 12if {"::tcltest" ni [namespace children]} { 13 package require tcltest 2.5 14 namespace import -force ::tcltest::* 15} 16 17::tcltest::loadTestedCommands 18catch [list package require -exact tcl::test [info patchlevel]] 19 20testConstraint testfindexecutable [llength [info commands testfindexecutable]] 21 22set oldpwd [pwd] 23cd [temporaryDirectory] 24 25catch { 26 set oldPath $env(PATH) 27 file attributes [makeFile "" junk] -perm 0o777 28} 29set absPath [file join [temporaryDirectory] junk] 30 31test unixFile-1.1 {Tcl_FindExecutable} {testfindexecutable unix} { 32 set env(PATH) "" 33 testfindexecutable junk 34} $absPath 35test unixFile-1.2 {Tcl_FindExecutable} {testfindexecutable unix} { 36 set env(PATH) "/dummy" 37 testfindexecutable junk 38} {} 39test unixFile-1.3 {Tcl_FindExecutable} {testfindexecutable unix} { 40 set env(PATH) "/dummy:[pwd]" 41 testfindexecutable junk 42} $absPath 43test unixFile-1.4 {Tcl_FindExecutable} {testfindexecutable unix} { 44 set env(PATH) "/dummy:" 45 testfindexecutable junk 46} $absPath 47test unixFile-1.5 {Tcl_FindExecutable} {testfindexecutable unix} { 48 set env(PATH) "/dummy:/dummy" 49 testfindexecutable junk 50} {} 51test unixFile-1.6 {Tcl_FindExecutable} {testfindexecutable unix} { 52 set env(PATH) "/dummy::/dummy" 53 testfindexecutable junk 54} $absPath 55test unixFile-1.7 {Tcl_FindExecutable} {testfindexecutable unix} { 56 set env(PATH) ":/dummy" 57 testfindexecutable junk 58} $absPath 59 60# cleanup 61catch {set env(PATH) $oldPath} 62removeFile junk 63cd $oldpwd 64::tcltest::cleanupTests 65return 66