sl@0: # This file contains tests for the routines in the file tclUnixFile.c sl@0: # sl@0: # This file contains a collection of tests for one or more of the Tcl sl@0: # built-in commands. Sourcing this file into Tcl runs the tests and sl@0: # generates output for errors. No output means no errors were found. sl@0: # sl@0: # Copyright (c) 1998-1999 by Scriptics Corporation. sl@0: # Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiaries. All rights reserved. sl@0: # sl@0: # See the file "license.terms" for information on usage and redistribution sl@0: # of this file, and for a DISCLAIMER OF ALL WARRANTIES. sl@0: # sl@0: # RCS: @(#) $Id: unixFile.test,v 1.7 2002/07/05 10:38:43 dkf Exp $ sl@0: sl@0: if {[lsearch [namespace children] ::tcltest] == -1} { sl@0: package require tcltest sl@0: namespace import -force ::tcltest::* sl@0: } sl@0: sl@0: if {[info commands testobj] == {}} { sl@0: puts "This application hasn't been compiled with the \"testfindexecutable\"" sl@0: puts "command, so I can't test the Tcl_FindExecutable function" sl@0: ::tcltest::cleanupTests sl@0: return sl@0: } sl@0: sl@0: set oldpwd [pwd] sl@0: cd [temporaryDirectory] sl@0: sl@0: catch { sl@0: set oldPath $env(PATH) sl@0: file attributes [makeFile "" junk] -perm 0777 sl@0: } sl@0: set absPath [file join [temporaryDirectory] junk] sl@0: sl@0: test unixFile-1.1 {Tcl_FindExecutable} {unixOnly tempNotSymbian} { sl@0: set env(PATH) "" sl@0: testfindexecutable junk sl@0: } $absPath sl@0: test unixFile-1.1.1 {Tcl_FindExecutable} {symbianOnly} { sl@0: set env(PATH) "" sl@0: testfindexecutable tcltest.exe sl@0: } "Z:/sys/bin/tcltest.exe" sl@0: test unixFile-1.1.2 {Tcl_FindExecutable} {symbianOnly} { sl@0: set env(PATH) "Z:\\sys\\bin\\" sl@0: testfindexecutable tcltest.exe sl@0: } "Z:/sys/bin/tcltest.exe" sl@0: sl@0: test unixFile-1.2 {Tcl_FindExecutable} {unixOnly tempNotSymbian} { sl@0: set env(PATH) "/dummy" sl@0: testfindexecutable junk sl@0: } {} sl@0: test unixFile-1.3 {Tcl_FindExecutable} {unixOnly tempNotSymbian} { sl@0: set env(PATH) "/dummy:[pwd]" sl@0: testfindexecutable junk sl@0: } $absPath sl@0: test unixFile-1.4 {Tcl_FindExecutable} {unixOnly tempNotSymbian} { sl@0: set env(PATH) "/dummy:" sl@0: testfindexecutable junk sl@0: } $absPath sl@0: test unixFile-1.5 {Tcl_FindExecutable} {unixOnly tempNotSymbian} { sl@0: set env(PATH) "/dummy:/dummy" sl@0: testfindexecutable junk sl@0: } {} sl@0: test unixFile-1.6 {Tcl_FindExecutable} {unixOnly tempNotSymbian} { sl@0: set env(PATH) "/dummy::/dummy" sl@0: testfindexecutable junk sl@0: } $absPath sl@0: test unixFile-1.7 {Tcl_FindExecutable} {unixOnly tempNotSymbian} { sl@0: set env(PATH) ":/dummy" sl@0: testfindexecutable junk sl@0: } $absPath sl@0: sl@0: # cleanup sl@0: catch {set env(PATH) $oldPath} sl@0: removeFile junk sl@0: cd $oldpwd sl@0: ::tcltest::cleanupTests sl@0: return