~ubuntu-branches/ubuntu/vivid/libcgi-ssi-perl/vivid

« back to all changes in this revision

Viewing changes to test.pl

  • Committer: Bazaar Package Importer
  • Author(s): Piotr Roszatycki
  • Date: 2007-09-10 13:44:13 UTC
  • mfrom: (3.1.2 lenny)
  • Revision ID: james.westby@ubuntu.com-20070910134413-elbt1gqsnzu6i8ad
Tags: 0.92-1
* New usptream release.
* debian/packages:
  - Convert LF/CR to LF in *.pm.
  - Remove executable bit for *.pm.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
use strict;
2
2
use warnings FATAL => 'all';
3
3
 
4
 
use Test::More tests => 26;
 
4
use Test::More tests => 29;
5
5
 
6
6
use List::Util qw(sum);
7
7
use File::Temp qw(tempfile tempdir);
291
291
        ok($@ =~ /^FH is closed/,'close()');
292
292
}
293
293
 
 
294
{
 
295
  # nested ifs
 
296
  my $ssi = CGI::SSI->new();
 
297
  my $html = $ssi->process(<<"");
 
298
    <!--#if expr="0" -->
 
299
      <!--#if expr="1" -->
 
300
        yes
 
301
      <!--#else -->
 
302
        no
 
303
      <!--#endif -->
 
304
      no
 
305
    <!--#else -->
 
306
      yes
 
307
    <!--#endif -->
 
308
 
 
309
  ok($html =~ /^\s*yes\s*$/s,'nested ifs');
 
310
}
 
311
 
 
312
{
 
313
  # timefmt applied to LAST_MODIFIED
 
314
  my $ssi = CGI::SSI->new();
 
315
  my $html = $ssi->process('<!--#config timefmt="%m/%d/%Y %X" --><!--#echo var="LAST_MODIFIED" -->');
 
316
 
 
317
  like($html, qr{^\d\d/\d\d/\d{4} \d\d:\d\d:\d\d$}, 'timefmt applied to LAST_MODIFIED');
 
318
}
 
319
 
 
320
{
 
321
  # newlines in directives
 
322
  my $ssi = CGI::SSI->new();
 
323
  my $html = $ssi->process('<!--#config 
 
324
 timefmt="%m/%d/%Y %X" --><!--#echo var="LAST_MODIFIED" -->');
 
325
 
 
326
  like($html, qr{^\d\d/\d\d/\d{4} \d\d:\d\d:\d\d$}, 'newlines in directives');
 
327
}
 
328
 
294
329
# autotie ?
295
330
 
296
331