File: 007_default_target.t

package info (click to toggle)
libcgi-application-server-perl 0.062-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze, wheezy
  • size: 164 kB
  • ctags: 23
  • sloc: perl: 548; makefile: 4
file content (52 lines) | stat: -rw-r--r-- 921 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
#!/usr/bin/perl

use strict;
use warnings;

use Test::More tests => 14;
use Test::Exception;

package main;

BEGIN {
    use_ok('CGI::Application::Server');
}

=pod

This could probably use some more tests, but it 
is good enough for now.

=cut

my $server = CGI::Application::Server->new();
isa_ok($server, 'CGI::Application::Server');
isa_ok($server, 'HTTP::Server::Simple');

$server->entry_points({
    '/'            => 'TopLevel',
    '/foo'         => 'Foo',
});

foreach my $uri (qw(
        /foo
        /foo?say=hello
        /foo/bling/bar
        /foo/?bar=baz
        /foo/barr
    )) {
    is($server->is_valid_entry_point($uri), 'Foo', '... got Foo where we expected');
}

foreach my $uri (qw(
        /
        /fooo
        /fooo/
        /food?say=hello
        /fooo/bar
        /fooo/barr/baz
    )) {
    is($server->is_valid_entry_point($uri), 'TopLevel', '... got TopLevel where we expected');
}