File: 010carp.t

package info (click to toggle)
libsysadm-install-perl 0.39-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 336 kB
  • sloc: perl: 734; makefile: 11
file content (53 lines) | stat: -rw-r--r-- 1,119 bytes parent folder | download | duplicates (4)
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
#####################################
# Tests for Sysadm::Install
#####################################

use Test::More tests => 3;

use Sysadm::Install qw(:all);
use File::Spec;
use File::Path;
#use Log::Log4perl qw(:easy);
#Log::Log4perl->easy_init($DEBUG);

my $TEST_DIR = ".";
$TEST_DIR = "t" if -d 't';

#################################
# cd
#################################
eval {
    cd "/this/directory/does/not/exist";
};

if($@) {
    like($@, qr(010carp.t), "'cd' reports failure in calling script");
} else {
    ok(0, "cd succeeded, but should have failed");
}

#################################
# mkd
#################################
eval {
    mkd "///";
};

if($@) {
    like($@, qr(010carp.t), "'mkd' reports failure in calling script");
} else {
    ok(0, "mkd succeeded, but should have failed");
}

#################################
# cp
#################################
eval {
    cp "Ill/go/crazy/if/this/whacko/directory/actually/exists", "//x";
};

if($@) {
    like($@, qr(010carp.t), "'cp' reports failure in calling script");
} else {
    ok(0, "cp succeeded, but should have failed");
}