APR-HTTP-Headers-Compat
view release on metacpan or search on metacpan
t/compat/base/headers.t view on Meta::CPAN
is( $h->as_string, "Bar: 2\nFoo: 1\nFoo-Bar: 3\n" );
is( $h->as_string( ";" ), "Bar: 2;Foo: 1;Foo-Bar: 3;" );
is( $h->header( "Foo" ), 1 );
is( $h->header( "FOO" ), 1 );
is( j( $h->header( "foo" ) ), 1 );
is( $h->header( "foo-bar" ), 3 );
is( $h->header( "foo_bar" ), 3 );
is( $h->header( "Not-There" ), undef );
is( j( $h->header( "Not-There" ) ), "" );
is( eval { $h->header }, undef );
ok( $@ );
is( $h->header( "Foo", 11 ), 1 );
is( $h->header( "Foo", [ 1, 1 ] ), 11 );
is( $h->header( "Foo" ), "1, 1" );
is( j( $h->header( "Foo" ) ), "1|1" );
is( $h->header( foo => 11, Foo => 12, bar => 22 ), 2 );
is( $h->header( "Foo" ), "11, 12" );
is( $h->header( "Bar" ), 22 );
is( $h->header( "Bar", undef ), 22 );
t/compat/base/headers.t view on Meta::CPAN
$h->clear;
$h->header( Foo => 1 );
is( $h->as_string, "Foo: 1\n" );
$h->init_header( Foo => 2 );
$h->init_header( Bar => 2 );
is( $h->as_string, "Bar: 2\nFoo: 1\n" );
$h->init_header( Foo => [ 2, 3 ] );
$h->init_header( Baz => [ 2, 3 ] );
is( $h->as_string, "Bar: 2\nBaz: 2\nBaz: 3\nFoo: 1\n" );
eval { $h->init_header( A => 1, B => 2, C => 3 ) };
ok( $@ );
is( $h->as_string, "Bar: 2\nBaz: 2\nBaz: 3\nFoo: 1\n" );
is( $h->clone->remove_header( "Foo" ), 1 );
is( $h->clone->remove_header( "Bar" ), 1 );
is( $h->clone->remove_header( "Baz" ), 2 );
is( $h->clone->remove_header( qw(Foo Bar Baz Not-There) ), 4 );
is( $h->clone->remove_header( "Not-There" ), 0 );
is( j( $h->clone->remove_header( "Foo" ) ), 1 );
is( j( $h->clone->remove_header( "Bar" ) ), 2 );
t/compat/base/headers.t view on Meta::CPAN
);
is( $h->header_field_names, 3 );
is( j( $h->header_field_names ), "ETag|Content-Type|Foo" );
{
my @tmp;
$h->scan( sub { push( @tmp, @_ ) } );
is( j( @tmp ), "ETag|1|Content-Type|text/plain|Foo|2|Foo|3" );
@tmp = ();
eval {
$h->scan( sub { push( @tmp, @_ ); die if $_[0] eq "Content-Type" }
);
};
ok( $@ );
is( j( @tmp ), "ETag|1|Content-Type|text/plain" );
@tmp = ();
$h->scan( sub { push( @tmp, @_ ) } );
is( j( @tmp ), "ETag|1|Content-Type|text/plain|Foo|2|Foo|3" );
}
t/compat/base/headers.t view on Meta::CPAN
if ( $] < 5.006 ) {
Test::skip( "Can't call variable method", 1 ) for 1 .. 13;
}
else {
# other date fields
for my $field (
qw(expires if_modified_since if_unmodified_since
last_modified)
) {
eval <<'EOT'; die $@ if $@;
is($h->$field, undef);
is($h->$field(time), undef);
ok((time - $h->$field) =~ /^[01]$/);
EOT
}
is( j( $h->header_field_names ),
"Date|If-Modified-Since|If-Unmodified-Since|Expires|Last-Modified"
);
}
t/compat/base/headers.t view on Meta::CPAN
is( $h->proxy_authenticate( "bar" ), "foo" );
is( $h->proxy_authenticate, "bar" );
is( $h->authorization_basic, undef );
is( $h->authorization_basic( "u" ), undef );
is( $h->authorization_basic( "u", "p" ), "u:" );
is( $h->authorization_basic, "u:p" );
is( j( $h->authorization_basic ), "u|p" );
is( $h->authorization, "Basic dTpw" );
is( eval { $h->authorization_basic( "u2:p" ) }, undef );
ok( $@ );
is( j( $h->authorization_basic ), "u|p" );
is( $h->proxy_authorization_basic( "u2", "p2" ), undef );
is( j( $h->proxy_authorization_basic ), "u2|p2" );
is( $h->proxy_authorization, "Basic dTI6cDI=" );
is( $h->as_string, <<EOT);
Authorization: Basic dTpw
Proxy-Authorization: Basic dTI6cDI=
t/pod-coverage.t view on Meta::CPAN
#!perl -T
use Test::More;
eval "use Test::Pod::Coverage 1.04";
plan skip_all =>
"Test::Pod::Coverage 1.04 required for testing POD coverage"
if $@;
all_pod_coverage_ok( { private => [ qr{^[A-Z]+$}, qr{^_} ] } );
#!perl -T
use Test::More;
eval "use Test::Pod 1.14";
plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
all_pod_files_ok();
( run in 1.657 second using v1.01-cache-2.11-cpan-98e64b0badf )