Commit | Line | Data |
09274aae |
1 | #!/usr/bin/perl |
2 | # live_fork.t |
3 | # Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org> |
4 | |
5 | =head1 SYNOPSIS |
6 | |
7 | Tests if Catalyst can fork/exec other processes successfully |
8 | |
9 | =cut |
10 | use strict; |
11 | use warnings; |
12 | use Test::More; |
13 | use YAML; |
14 | use FindBin; |
15 | use lib "$FindBin::Bin/lib"; |
16 | use Catalyst::Test qw(TestApp); |
17 | |
18 | plan 'skip_all' if !-e '/bin/ls'; # see if /bin/ls exists |
19 | plan tests => 4; # otherwise |
20 | |
21 | ok(my $result = get('/fork/%2Fbin%2Fls'), 'get /fork//bin/ls'); |
22 | my @result = split /$/m, $result; |
23 | $result = join "", @result[-4..-1]; |
24 | |
25 | my $result_ref = eval { Load($result) }; |
26 | ok($result_ref, 'is YAML'); |
27 | is($result_ref->{code}, 0, 'exited successfully'); |
28 | like($result_ref->{result}, qr{^/bin/ls[^:]}, 'contains ^/bin/ls$'); |