stas 2004/08/01 16:53:13
Modified: t/api .cvsignore
t/response/TestAPI request_rec.pm
Added: t/api request_rec.t
Log:
improve the request_rec test
Revision Changes Path
1.9 +0 -1 modperl-2.0/t/api/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/modperl-2.0/t/api/.cvsignore,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -u -r1.8 -r1.9
--- .cvsignore 16 Jul 2004 22:38:36 -0000 1.8
+++ .cvsignore 1 Aug 2004 23:53:13 -0000 1.9
@@ -5,7 +5,6 @@
lookup_uri2.t
module.t
process.t
-request_rec.t
response.t
request_subclass.t
request_util.t
1.1 modperl-2.0/t/api/request_rec.t
Index: request_rec.t
===================================================================
use strict;
use warnings FATAL => 'all';
use Apache::TestRequest 'GET_BODY_ASSERT';
print GET_BODY_ASSERT "/TestAPI__request_rec/my_path_info?my_args=3";
1.28 +24 -15 modperl-2.0/t/response/TestAPI/request_rec.pm
Index: request_rec.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -u -r1.27 -r1.28
--- request_rec.pm 24 Jul 2004 09:25:49 -0000 1.27
+++ request_rec.pm 1 Aug 2004 23:53:13 -0000 1.28
@@ -100,28 +100,38 @@
ok $r->no_cache || 1;
+ ok !$r->no_local_copy;
+
{
local $| = 0;
- ok 11 == $r->print("# buffered\n");
- ok 0 == $r->print();
+ ok t_cmp $r->print("# buffered\n"), 11, "buffered print";
+ ok t_cmp $r->print(), 0, "buffered print";
+
local $| = 1;
- ok 15 == $r->print('#',' ','n','o','t','
','b','u','f','f','e','r','e','d',"\n");
+ my $string = "# not buffered\n";
+ ok t_cmp $r->print(split //, $string), length($string),
+ "unbuffered print";
}
- ok !$r->no_local_copy;
+ # GET header components
+ {
+ my $args = "my_args=3";
+ my $path_info = "/my_path_info";
+ my $base_uri = "/TestAPI__request_rec";
- ok $r->unparsed_uri;
+ ok t_cmp $r->unparsed_uri, "$base_uri$path_info?$args";
- ok $r->uri;
+ ok t_cmp $r->uri, "$base_uri$path_info", '$r->uri';
- ok $r->filename;
+ ok t_cmp $r->path_info, $path_info, '$r->path_info';
- my $location = '/' . Apache::TestRequest::module2path(__PACKAGE__);
- ok t_cmp($r->location, $location, "location");
+ ok t_cmp $r->args, $args, '$r->args';
- ok $r->path_info || 1;
+ ok $r->filename;
- ok $r->args || 1;
+ my $location = '/' . Apache::TestRequest::module2path(__PACKAGE__);
+ ok t_cmp $r->location, $location, '$r->location';
+ }
# bytes_sent
{
@@ -161,15 +171,14 @@
ok $r->allowed & (1 << Apache::M_PUT);
}
- #parsed_uri
+ # per_dir_config in several other tests
- #per_dir_config
- #request_config
+ # request_config
# input_filters and output_filters are tested in
# TestAPI::in_out_filters;
- #eos_sent
+ # eos_sent
Apache::OK;
}