File: testFilesInDir

package info (click to toggle)
gnump3d 2.9.3-1sarge3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,420 kB
  • ctags: 366
  • sloc: perl: 10,649; sh: 188; makefile: 147
file content (52 lines) | stat: -rwxr-xr-x 609 bytes parent folder | download
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
#!/usr/bin/perl -w
#  Test that it is possible to list files in directories.

use gnump3d::files;

#
#  Create a clean subdirectory.
#
`rm -rf ./foo`;
`mkdir ./foo`;



#
#  Create two files in that directory, and
# some subdirectories.
#
`ls > ./foo/ls.txt`;
`ls > ./foo/ls2.txt`;
`mkdir ./foo/clair`;
`mkdir ./foo/sally`;
`mkdir ./foo/sara`;

#
#  Read the number of files.
#
my @files = &filesInDir("foo/");

#
#  Cleanup.
#
`rm -rf ./foo`;

#
# Did we get something at all?
if ( ! @files )
{
	exit 1;
}

#
#  Were there two files there?  (0 based).
#
if ( $#files != 1 )
{
	exit 1;
}


#
# All OK
exit 0;