Add PerlIO methods to Catalyst::Response, so that it more properly
[catagits/Catalyst-Runtime.git] / t / aggregate / live_engine_response_perlio.t
CommitLineData
c9373e69 1#!perl
2
3use strict;
4use warnings;
5
6use FindBin;
7use lib "$FindBin::Bin/../lib";
8
9use Test::More;
10use Catalyst::Test 'TestApp';
11
12my $types = {
13 #zip => ['Archive::Zip', 464, qr/^PK\x03\x04.*[\x80-\xFF]+.*x.txt/s],
14 ### Archive::Zip currently unreliable as a test platform until RT #54827 is fixed and popularized ###
15 ### https://rt.cpan.org/Ticket/Display.html?id=54827 ###
16
17 csv => ['Text::CSV', 96, qr/"Banana \(single\)","\$ \.40"$/m],
18 xml => ['XML::Simple', 1657, qr(</geocode>)],
19};
20
21plan tests => scalar keys %$types;
22
23for my $action ( keys %$types ) {
24 my ($module, $length, $regexp) = @{$types->{$action}};
25
26 subtest uc($action)." Set" => sub {
27 undef $@;
28 eval "require $module"; # require hates string class names; must use eval string instead of block
29 print $@;
30 plan ($@ ? (skip_all => $module.' not installed') : (tests => 4) );
31
32 ok( my $response = request('http://localhost/engine/response/perlio/' . $action ), "Request" );
33 ok( $response->is_success, "Response Successful 2xx" );
34 is( length( $response->content ), $length, "Length OK" );
35 like( $response->content, $regexp, "RegExp Check OK" );
36 done_testing();
37 };
38}
39
40done_testing();