You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2002/05/18 04:14:47 UTC
cvs commit: modperl-2.0/t/response/TestModperl method.pm
dougm 02/05/17 19:14:47
Modified: t/conf modperl_extra.pl
t/response/TestModperl method.pm
Log:
add an additional test for object handlers
Revision Changes Path
1.15 +1 -1 modperl-2.0/t/conf/modperl_extra.pl
Index: modperl_extra.pl
===================================================================
RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- modperl_extra.pl 18 May 2002 02:08:21 -0000 1.14
+++ modperl_extra.pl 18 May 2002 02:14:47 -0000 1.15
@@ -24,7 +24,7 @@
#see t/modperl/methodobj
use TestModperl::methodobj ();
-$TestModperl::MethodObj = bless {}, 'TestModperl::methodobj';
+$TestModperl::MethodObj = TestModperl::methodobj->new;
#see t/response/TestModperl/env.pm
$ENV{MODPERL_EXTRA_PL} = __FILE__;
1.2 +26 -5 modperl-2.0/t/response/TestModperl/method.pm
Index: method.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestModperl/method.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- method.pm 18 May 2002 02:07:42 -0000 1.1
+++ method.pm 18 May 2002 02:14:47 -0000 1.2
@@ -8,21 +8,42 @@
use Apache::Const -compile => 'OK';
+sub new {
+ my $class = shift;
+
+ bless {
+ perl_version => $],
+ }, $class;
+}
+
sub handler : method {
- my($class, $r) = @_;
+ my($self, $r) = @_;
+
+ my $tests = 3;
- plan $r, tests => 3;
+ my $is_obj = ref($self);
+
+ if ($is_obj) {
+ $tests += 1;
+ }
+
+ plan $r, tests => $tests;
ok t_cmp(2, scalar @_,
'@_ == 2');
- my $cmp_class = ref($class) || $class;
+ my $class = ref($self) || $self;
- ok t_cmp($cmp_class, $cmp_class,
+ ok t_cmp($class, $class,
'handler class');
- ok t_cmp('/' . $cmp_class, $r->uri,
+ ok t_cmp('/' . $class, $r->uri,
'$r->uri eq __PACKAGE__');
+
+ if ($is_obj) {
+ ok t_cmp($], $self->{perl_version},
+ 'object handler data');
+ }
Apache::OK;
}