File: test_dirs.t

package info (click to toggle)
libtest-file-perl 1.41-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 244 kB
  • ctags: 54
  • sloc: perl: 986; makefile: 2
file content (48 lines) | stat: -rw-r--r-- 1,174 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
use strict;
use warnings;

use Test::Builder::Tester;
use Test::More 0.95;
use Test::File;

use File::Spec::Functions qw(catfile);

require "t/setup_common";
open FH, '>', catfile( qw(sub_dir subdir_file) ); close FH;


test_out( 'ok 1 - sub_dir is a directory' );
dir_exists_ok( 'sub_dir' );
test_test();

test_out( 'not ok 1 - bmoogle is a directory' );
test_diag( 'File [bmoogle] does not exist!' );
test_fail(+1);
dir_exists_ok( 'bmoogle' );
test_test();

test_out( 'not ok 1 - readable is a directory' );
test_diag( 'File [readable] exists but is not a directory!' );
test_fail(+1);
dir_exists_ok( 'readable' );
test_test();

test_out( 'ok 1 - directory sub_dir contains file subdir_file' );
dir_contains_ok( 'sub_dir', 'subdir_file' );
test_test();

test_out( 'not ok 1 - directory bmoogle contains file subdir_file' );
test_diag( 'Directory [bmoogle] does not exist!' );
test_fail(+1);
dir_contains_ok( 'bmoogle', 'subdir_file' );
test_test();

test_out( 'not ok 1 - directory sub_dir contains file bmoogle' );
test_diag( 'File [bmoogle] does not exist in directory sub_dir!' );
test_fail(+1);
dir_contains_ok( 'sub_dir', 'bmoogle' );
test_test();


done_testing();