tagged release 0.7.1
[parrot.git] / languages / tcl / t / cmd_file.t
blob37e6d8bc9bbf36604eb69579e41aba7417e6cc52
1 #!perl
3 # Copyright (C) 2006-2007, The Perl Foundation.
4 # $Id$
6 # the following lines re-execute this as a tcl script
7 # the \ at the end of these lines makes them a comment in tcl \
8 use lib qw(languages/tcl/lib tcl/lib lib ../lib ../../lib); # \
9 use Tcl::Test; #\
10 __DATA__
12 source lib/test_more.tcl
14 plan 13 ;# from outer space. (HAH!)
16 # [file exists]
17 eval_is {file exists} \
18   {wrong # args: should be "file exists name"} \
19   {[file exists] too few args}
21 eval_is {file exists foo bar} \
22   {wrong # args: should be "file exists name"} \
23   {[file exists] too many args}
25 # this should fail everywhere
26 is [file exists :%:/bar] 0 {[file exists] does not exist}
28 # we really should create a file to test this, but since our "source" line
29 # above means we have to have that path to this file..
30 is [file exists lib/test_more.tcl] 1 {[file exists] does exist}
32 # [file rootname]
33 eval_is {file rootname} \
34   {wrong # args: should be "file rootname name"} \
35   {[file rootname] too few args}
36 eval_is {file rootname foo bar} \
37   {wrong # args: should be "file rootname name"} \
38   {[file rootname] too many args}
40 is [file rootname file] file  \
41   {[file rootname] filename only}
43 is [file rootname file.ext] file \
44   {[file rootname] filename with extension}
46 is [file rootname f..i.le.ext] f..i.le \
47   {[file rootname] filename with dots and extension}
49 # [file dirname]
50 eval_is {file dirname} \
51   {wrong # args: should be "file dirname name"} \
52   {[file dirname] too few args}
53 eval_is {file dirname foo bar} \
54   {wrong # args: should be "file dirname name"} \
55   {[file dirname] too many args}
57 is [file dirname .] .  \
58   {[file dirname] dirname dot}
60 is [file dirname file.ext] .  \
61   {[file dirname] dirname simple file}