FAQ sync.
[p5sagit/p5-mst-13.2.git] / lib / CGI / t / fast.t
1 #!./perl -w
2
3 BEGIN {
4         chdir 't' if -d 't';
5         if ($ENV{PERL_CORE}) {
6                 @INC = '../lib';
7         } else {
8                 # Due to a bug in older versions of MakeMaker & Test::Harness, we must
9                 # ensure the blib's are in @INC, else we might use the core CGI.pm
10                 unshift @INC, qw( ../blib/lib ../blib/arch lib );
11         }
12 }
13
14 my $fcgi;
15 BEGIN {
16         local $@;
17         eval { require FCGI };
18         $fcgi = $@ ? 0 : 1;
19 }
20
21 use Test::More tests => 7;
22
23 # Shut up "used only once" warnings.
24 () = $CGI::Q;
25 () = $CGI::Fast::Ext_Request;
26
27 SKIP: {
28         skip( 'FCGI not installed, cannot continue', 7 ) unless $fcgi;
29
30         use_ok( CGI::Fast );
31         ok( my $q = CGI::Fast->new(), 'created new CGI::Fast object' );
32         is( $q, $CGI::Q, 'checking to see if the object was stored properly' );
33         is( $q->param(), (), 'no params' );
34
35         ok( $q = CGI::Fast->new({ foo => 'bar' }), 'creating obect with params' );
36         is( $q->param('foo'), 'bar', 'checking passed param' );
37
38         # if this is false, the package var will be empty
39         $ENV{FCGI_SOCKET_PATH} = 0;
40         is( $CGI::Fast::Ext_Request, '', 'checking no active request' );
41
42 }