File: 08_crashme.t

package info (click to toggle)
libconfig-crontab-perl 1.45-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 1,198; makefile: 4
file content (39 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (5)
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
#-*- mode: cperl -*-#
use Test::More;
use blib;

chdir 't' if -d 't';
require './setup.pl';

unless( have_crontab() ) {
    plan skip_all => "no crontab available";
    exit;
}

plan tests => 5;

use_ok('Config::Crontab');

my $ct;

## make some objects
my $com1 = new Config::Crontab::Comment( -data => "## Well! If microwaves don't" );
my $com2 = new Config::Crontab::Comment( -data => "## take the cake!" );
my $env1 = new Config::Crontab::Env( -data => 'MAILTO=joe@schmoe.org' );
my $event1 = new Config::Crontab::Event( -data => '30 4 * * Wed /bin/wednesday' );

## do tests by adding non-block objects to a crontab
$ct = new Config::Crontab;
is( $ct->last($com1, $com2, $env1, $event1), 0, "last entry" );
my $rv = <<'_CRONTAB_';
## Well! If microwaves don't
## take the cake!
MAILTO=joe@schmoe.org
30 4 * * Wed /bin/wednesday
_CRONTAB_
chomp $rv;  ## chomped because not a block
is( $ct->dump, '', "empty dump" );

## try some selects, deletes, etc.
is( $ct->select, 0, "select empty" );
ok( ! $ct->remove($com1), "remove empty" ); ## FIXME: Perl 5.6.1 says '0', Perl 5.00503 says ''; we use !