File: 010_errors.t

package info (click to toggle)
libfcgi-engine-perl 0.22-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 360 kB
  • sloc: perl: 3,226; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,130 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 7;
use Test::Exception;
use Test::Moose;

BEGIN {
    use_ok('FCGI::Engine');
}

{
    package Foo;
    sub handler { ::pass("... handler was called") }
}

@ARGV = ();

dies_ok {
    FCGI::Engine->new_with_options;
} '... cant build class with out handler_class';

# dies_ok {
#     FCGI::Engine->new_with_options(
#         handler_class => 'Foo', 
#         handler_method => 'run'
#     );
# } '... cant have a handler method which is not supported by the handler class';

{
    my $e = FCGI::Engine->new_with_options(handler_class => 'Foo');
    isa_ok($e, 'FCGI::Engine');
    
    dies_ok {
        $e->pid_obj
    } '... cannot get a pid object if there is no pidfile specified';
}

@ARGV = ('--listen', '/tmp/foo.socket');

dies_ok {
    FCGI::Engine->new_with_options(handler_class => 'Foo');
} '... cant have socket but not pidfile';

push @ARGV => ('--pidfile', '/tmp/foo.pid');

{
    my $e = FCGI::Engine->new_with_options(handler_class => 'Foo');
    isa_ok($e, 'FCGI::Engine');
    
    ok($e->has_pidfile, '... we have a pidfile specified');
}