~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy

« back to all changes in this revision

Viewing changes to t/response/TestApache/read2.pm

  • Committer: Bazaar Package Importer
  • Author(s): Andres Salomon
  • Date: 2005-08-12 01:40:38 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050812014038-gjigefs55pqx4qc8
Tags: 2.0.1-3
Grr.  Really include perl.conf file; it got lost due to diff not
wanting to add an empty file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package TestApache::read2;
 
2
 
 
3
# extra tests in addition to TestApache::read
 
4
 
 
5
use strict;
 
6
use warnings FATAL => 'all';
 
7
 
 
8
use Apache2::RequestRec ();
 
9
use Apache2::RequestIO ();
 
10
use APR::Table ();
 
11
 
 
12
use Apache::Test;
 
13
use Apache::TestUtil;
 
14
 
 
15
use Apache2::Const -compile => qw(OK);
 
16
 
 
17
my $expected = "foobar";
 
18
 
 
19
sub handler {
 
20
    my $r = shift;
 
21
 
 
22
    plan $r, tests => 1;
 
23
 
 
24
    # test the case where the buffer to be filled has set magic
 
25
    # attached. which is the case when one passes an non-existing hash
 
26
    # entry value. it's not autovivified when passed to the function
 
27
    # and it's not undef. running SetMAGIC inside read accomplishes
 
28
    # the autovivication in this particular case.
 
29
    my $data;
 
30
    my $len = $r->read($data->{buffer}, $r->headers_in->{'Content-Length'});
 
31
 
 
32
    ok t_cmp($data->{buffer},
 
33
             $expected,
 
34
             "reading into an autovivified hash entry");
 
35
 
 
36
    Apache2::Const::OK;
 
37
}
 
38
1;
 
39