joes 2003/06/08 23:30:05
Added: glue/perl/t/apreq big_input.t cookie.t inherit.t request.t
Removed: glue/perl/t/apreq-2 big_input.t cookie.t inherit.t request.t
Log:
Rename glue/perl/t/apreq-2 glue/perl/t/apreq to match Apache::Test naming
convention.
Revision Changes Path
1.1 httpd-apreq-2/glue/perl/t/apreq/big_input.t
Index: big_input.t
===================================================================
use strict;
use warnings FATAL => 'all';
# test the processing of variations of the key lengths and the keys
# numbers
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw(GET_BODY POST_BODY);
my $location = "/TestApReq__big_input";
my @key_len = (5, 100, 305);
my @key_num = (5, 15, 26);
my @keys = ('a'..'z');
my @big_key_len = (100, 500, 5000, 10000);
my @big_key_num = (5, 15, 25);
my @big_keys = ('a'..'z');
plan tests => @key_len * @key_num + @big_key_len * @big_key_num;
# GET
my $len = 0;
for my $key_len (@key_len) {
for my $key_num (@key_num) {
my @query = ();
for my $key (@keys[0..($key_num-1)]) {
my $pair = "$key=" . 'd' x $key_len;
$len += length $pair;
push @query, $pair;
}
my $query = join "&", @query;
$len += @query - 1; # the stick with two ends one '&' char off
my $body = GET_BODY "$location?$query";
t_debug "# of keys : $key_num, key_len $key_len";
ok t_cmp(( ($key_len + 3) * $key_num - 1),
$body,
"GET long query");
}
}
# POST
$len = 0;
for my $big_key_len (@big_key_len) {
for my $big_key_num (@big_key_num) {
my @query = ();
for my $big_key (@big_keys[0..($big_key_num-1)]) {
my $pair = "$big_key=" . 'd' x $big_key_len;
$len += length $pair;
push @query, $pair;
}
my $query = join "&", @query;
$len += @query - 1; # the stick with two ends one '&' char off
my $body = POST_BODY $location, content => $query;
t_debug "# of keys : $big_key_num, key_len $big_key_len";
ok t_cmp(( ($big_key_len + 3) * $big_key_num - 1),
$body,
"POST big data");
}
}
1.1 httpd-apreq-2/glue/perl/t/apreq/cookie.t
Index: cookie.t
===================================================================
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw(GET_BODY);
use HTTP::Cookies;
plan tests => 1;
my $location = "/TestApReq__cookie";
{
# basic param() test
my $test = 'basic';
my $key = 'apache';
my $value = 'ok';
my $cookie = qq{\$Version="1"; $key="$value"; \$Path="$location"};
ok t_cmp(qq{"$value"},
GET_BODY("$location?test=$test&key=$key", Cookie => $cookie),
$test);
}
1.1 httpd-apreq-2/glue/perl/t/apreq/inherit.t
Index: inherit.t
===================================================================
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw(GET_BODY UPLOAD_BODY);
plan tests => 1;
my $location = "/TestApReq__inherit";
ok t_cmp(<< 'VALUE', GET_BODY($location), "inheritance");
method => GET
VALUE
1.1 httpd-apreq-2/glue/perl/t/apreq/request.t
Index: request.t
===================================================================
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw(GET_BODY UPLOAD_BODY);
plan tests => 2;
my $location = "/TestApReq__request";
#print GET_BODY $location;
{
# basic param() test
my $test = 'param';
my $value = '42.5';
ok t_cmp($value,
GET_BODY("$location?test=$test&value=$value"),
"basic param");
}
{
# upload a string as a file
my $test = 'upload';
my $value = 'data upload';
ok t_cmp($value,
UPLOAD_BODY("$location?test=$test", content => $value),
"basic upload");
}