Commit 07446ed4 authored by Xavier Guimard's avatar Xavier Guimard

More tests

parent 9fdea738
......@@ -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
......
......@@ -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( ( $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} = '';
ok( ( Lemonldap::NG::Common::CGI->new()), 'New CGI');
# 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' );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment