~ubuntu-branches/ubuntu/saucy/libhtml-stripscripts-perl/saucy

« back to all changes in this revision

Viewing changes to t/22input_end.t

  • Committer: Bazaar Package Importer
  • Author(s): Tim Retout
  • Date: 2008-08-07 17:21:30 UTC
  • Revision ID: james.westby@ubuntu.com-20080807172130-3l9o4bwl9ftodfqh
Tags: upstream-1.04
ImportĀ upstreamĀ versionĀ 1.04

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
use strict;
 
3
use Test::More tests => 7;
 
4
 
 
5
BEGIN { $^W = 1 }
 
6
 
 
7
use HTML::StripScripts;
 
8
my $f = HTML::StripScripts->new;
 
9
 
 
10
mytest( '',      '<!--filtered--></i>', 'reject null' );
 
11
mytest( '</>',   '<!--filtered--></i>', 'reject empty' );
 
12
mytest( '</->',  '<!--filtered--></i>', 'reject malformed' );
 
13
mytest( '</foo>','<!--filtered--></i>', 'reject unknown' );
 
14
mytest( '</b>',  '<!--filtered--></i>', 'reject misplaced' );
 
15
mytest( '</i>',  '</i>',                'accept valid' );
 
16
mytest( '</I>',  '</i>',                'accept uppercase' );
 
17
 
 
18
sub mytest {
 
19
    my ($in, $out, $name) = @_;
 
20
 
 
21
    $f->input_start_document;
 
22
    $f->input_start('<i>');
 
23
    $f->input_text('foo');
 
24
    $f->input_end($in);
 
25
    $f->input_end_document;
 
26
    is( $f->filtered_document, "<i>foo$out", "input_end $name" );
 
27
}
 
28