More tests

This commit is contained in:
Xavier Guimard 2009-02-19 09:34:09 +00:00
parent 9fdea7384f
commit 07446ed429
2 changed files with 31 additions and 3 deletions

View File

@ -4,7 +4,7 @@ Priority: extra
Maintainer: Xavier Guimard <x.guimard@free.fr>
DM-Upload-Allowed: yes
Build-Depends: debhelper (>= 4.1.16), po-debconf
Build-Depends-Indep:libapache-session-perl, libnet-ldap-perl, libdbi-perl, libwww-perl, libcache-cache-perl, libxml-simple-perl, libcgi-session-perl, libcrypt-rijndael-perl, libxml-libxslt-perl
Build-Depends-Indep:libapache-session-perl, libnet-ldap-perl, libdbi-perl, libwww-perl, libcache-cache-perl, libxml-simple-perl, libcgi-session-perl, libcrypt-rijndael-perl, libxml-libxslt-perl, libio-string-perl
Standards-Version: 3.8.0
Package: lemonldap-ng

View File

@ -4,17 +4,45 @@
#########################
# change 'tests => 1' to 'tests => last_test_to_print';
package My::Portal;
use Test::More tests => 2;
BEGIN { use_ok('Lemonldap::NG::Common::CGI') }
our @ISA = ('Lemonldap::NG::Common::CGI');
sub subtest {
return 'OK1';
}
#########################
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
my $h;
my $cgi;
ok( ( Lemonldap::NG::Common::CGI->new()), 'New CGI');
ok( ( $cgi = My::Portal->new() ), 'New CGI' );
use IO::String;
our $buf;
#tie *STDOUT, 'IO::String', $buf;
$ENV{SCRIPT_NAME} = '/test.pl';
$ENV{SCRIPT_FILENAME} = 't/20-Common-CGI.t';
$ENV{REQUEST_METHOD} = 'GET';
$ENV{REQUEST_URI} = '/';
$ENV{QUERY_STRING} = '';
# Test header_public
ok( $buf = $cgi->header_public('t/20-Common-CGI.t'), 'header_public' );
ok( $buf =~ /Cache-control: public; must-revalidate; max-age=\d+\r?\n/s,
'Cache-Control' );
ok( $buf =~ /Last-modified: /, 'Last-Modified' );
# Test _sub mechanism
ok( $cgi->_sub('subtest') eq 'OK1', '_sub mechanism 1' );
$cgi->{subtest} = sub { return 'OK2' };
ok( $cgi->_sub('subtest') eq 'OK2', '_sub mechanism 2' );