File: 02errs.t

package info (click to toggle)
libschedule-cron-events-perl 1.96-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 224 kB
  • sloc: perl: 903; makefile: 7
file content (88 lines) | stat: -rwxr-xr-x 1,887 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/perl

use strict;
use warnings;

use lib './lib';
use Test;
use Schedule::Cron::Events;
use Time::Local;
use Data::Dumper;

# $Id: 02errs.t,v 1.1 2002/09/11 19:54:37 piers Exp $

my $obj;
my @rv;

plan tests => 12;

# check comments are not allowed
$obj = new Schedule::Cron::Events("# this is a comment\n", Date => [0, 0, 15, 14, 1, 101]);
ok(! $obj);

# no blank lines
$obj = new Schedule::Cron::Events("\n", Date => [0, 0, 15, 14, 1, 101]);
ok(! $obj);

# env var lines
$obj = new Schedule::Cron::Events("VARIABLE=value\n", Date => [0, 0, 15, 14, 1, 101]);
ok(! $obj);

# not a crontab line
$obj = new Schedule::Cron::Events("THE HOMECOMING\n", Date => [0, 0, 15, 14, 1, 101]);
ok(! $obj);

# not a crontab line either
eval {
  $obj = new Schedule::Cron::Events("As I was going to Aylesbury all on a market day,\n", Date => [0, 0, 15, 14, 1, 101]);
};
ok($@ ne '');
TRACE($@);

# bad crontab lines
eval {
  $obj = new Schedule::Cron::Events("63 * * * * /bin/never\n", Date => [0, 0, 15, 14, 1, 101]);
};
ok($@ ne '');
TRACE($@);

eval {
  $obj = new Schedule::Cron::Events("* 24 * * * /bin/never\n", Date => [0, 0, 15, 14, 1, 101]);
};
ok($@ ne '');
TRACE($@);

eval {
  $obj = new Schedule::Cron::Events("* * 33 * * /bin/never\n", Date => [0, 0, 15, 14, 1, 101]);
};
ok($@ ne '');
TRACE($@);

eval {
  $obj = new Schedule::Cron::Events("* * 0 * * /bin/never\n", Date => [0, 0, 15, 14, 1, 101]);
};
ok($@ ne '');
TRACE($@);

eval {
  $obj = new Schedule::Cron::Events("* * * 14 * /bin/never\n", Date => [0, 0, 15, 14, 1, 101]);
};
ok($@ ne '');
TRACE($@);

eval {
  $obj = new Schedule::Cron::Events("* * * 0 * /bin/never\n", Date => [0, 0, 15, 14, 1, 101]);
};
ok($@ ne '');
TRACE($@);

eval {
  $obj = new Schedule::Cron::Events("* * * * 9 /bin/never\n", Date => [0, 0, 15, 14, 1, 101]);
};
ok($@ ne '');
TRACE($@);

sub TRACE {
  my $msg = shift;
# print "## $msg\n";
}