fix Test::More version used, for done_testing
[catagits/Web-Simple.git] / t / match-home.t
CommitLineData
cc57831f 1use strictures 1;
a30328b3 2use Test::More 0.88;
cc57831f 3
4{
5 package t::Web::Simple::MatchHome;
6
7 use Web::Simple;
8
9 sub as_text {
10 [200, ['Content-Type' => 'text/plain'],
11 [$_[0]->{REQUEST_METHOD}, $_[0]->{REQUEST_URI}] ]
12 }
13
14 sub dispatch_request {
15 sub (/foo...) {
16 sub (~) { as_text(pop) },
17 sub (/bar) { as_text(pop) },
18 sub (/baz) { as_text(pop) },
19 sub (/*) { as_text(pop) },
20 sub (/bork...) {
21 sub (~) { as_text(pop) },
22 sub (/bar) { as_text(pop) },
23 }
24 },
25 sub (/...) {
26 sub (/baz) { as_text(pop) },
27 sub (/fob...) {
28 sub (~) { as_text(pop) },
29 sub (/bar) { as_text(pop) },
30 }
31 }
32 }
33}
34
35ok my $app = t::Web::Simple::MatchHome->new,
36 'made app';
37
38for(ok my $res = $app->run_test_request(GET => '/foo')) {
39 is $res->content, 'GET/foo';
40}
41
42for(ok my $res = $app->run_test_request(GET => '/foo/bar')) {
43 is $res->content, 'GET/foo/bar';
44}
45
46for(ok my $res = $app->run_test_request(GET => '/foo/baz')) {
47 is $res->content, 'GET/foo/baz';
48}
49
50for(ok my $res = $app->run_test_request(GET => '/foo/id')) {
51 is $res->content, 'GET/foo/id';
52}
53
54
55for(ok my $res = $app->run_test_request(GET => '/foo/bork')) {
56 is $res->content, 'GET/foo/bork';
57}
58
59for(ok my $res = $app->run_test_request(GET => '/foo/bork/bar')) {
60 is $res->content, 'GET/foo/bork/bar';
61}
62
63for(ok my $res = $app->run_test_request(GET => '/fob')) {
64 is $res->content, 'GET/fob';
65}
66
67for(ok my $res = $app->run_test_request(GET => '/baz')) {
68 is $res->content, 'GET/baz';
69}
70
71for(ok my $res = $app->run_test_request(GET => '/fob/bar')) {
72 is $res->content, 'GET/fob/bar';
73}
74
75done_testing;