Add the original source packages to maemo, source lenny
[dh-make-perl] / dev / i386 / libwww-perl / libwww-perl-5.813 / t / live / jigsaw-chunk.t
1 print "1..5\n";
2
3 use strict;
4 use LWP::UserAgent;
5
6 my $ua = LWP::UserAgent->new(keep_alive => 1);
7
8 my $req = HTTP::Request->new(GET => "http://jigsaw.w3.org/HTTP/ChunkedScript");
9 my $res = $ua->request($req);
10
11 print "not " unless $res->is_success && $res->content_type eq "text/plain";
12 print "ok 1\n";
13
14 print "not " unless $res->header("Client-Transfer-Encoding") eq "chunked";
15 print "ok 2\n";
16
17 for (${$res->content_ref}) {
18     s/\015?\012/\n/g;
19     /Below this line, is 1000 repeated lines of 0-9/ || die;
20     s/^.*?-----+\n//s;
21
22     my @lines = split(/^/);
23     print "not " if @lines != 1000;
24     print "ok 3\n";
25
26     # check that all lines are the same
27     my $first = shift(@lines);
28     my $no_they_are_not;
29     for (@lines) {
30         $no_they_are_not++ if $_ ne $first;
31     }
32     print "not " if $no_they_are_not;
33     print "ok 4\n";
34
35     print "not " unless $first =~ /^\d+$/;
36     print "ok 5\n";
37 }