-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd_file.t
executable file
·60 lines (45 loc) · 1.6 KB
/
cmd_file.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!perl
# Copyright (C) 2006-2007, The Parrot Foundation.
# the following lines re-execute this as a tcl script
# the \ at the end of these lines makes them a comment in tcl \
use lib qw(lib); #\
use Tcl::Test; #\
__DATA__
source lib/test_more.tcl
plan 13
# [file exists]
eval_is {file exists} \
{wrong # args: should be "file exists name"} \
{[file exists] too few args}
eval_is {file exists foo bar} \
{wrong # args: should be "file exists name"} \
{[file exists] too many args}
# this should fail everywhere
is [file exists :%:/bar] 0 {[file exists] does not exist}
# we really should create a file to test this, but since our "source" line
# above means we have to have that path to this file..
is [file exists lib/test_more.tcl] 1 {[file exists] does exist}
# [file rootname]
eval_is {file rootname} \
{wrong # args: should be "file rootname name"} \
{[file rootname] too few args}
eval_is {file rootname foo bar} \
{wrong # args: should be "file rootname name"} \
{[file rootname] too many args}
is [file rootname file] file \
{[file rootname] filename only}
is [file rootname file.ext] file \
{[file rootname] filename with extension}
is [file rootname f..i.le.ext] f..i.le \
{[file rootname] filename with dots and extension}
# [file dirname]
eval_is {file dirname} \
{wrong # args: should be "file dirname name"} \
{[file dirname] too few args}
eval_is {file dirname foo bar} \
{wrong # args: should be "file dirname name"} \
{[file dirname] too many args}
is [file dirname .] . \
{[file dirname] dirname dot}
is [file dirname file.ext] . \
{[file dirname] dirname simple file}