File: 22input_end.t

package info (click to toggle)
libhtml-stripscripts-perl 1.06-1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 492 kB
  • sloc: perl: 1,004; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 790 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

use strict;
use Test::More tests => 7;

BEGIN { $^W = 1 }

use HTML::StripScripts;
my $f = HTML::StripScripts->new;

mytest( '',      '<!--filtered--></i>', 'reject null' );
mytest( '</>',   '<!--filtered--></i>', 'reject empty' );
mytest( '</->',  '<!--filtered--></i>', 'reject malformed' );
mytest( '</foo>','<!--filtered--></i>', 'reject unknown' );
mytest( '</b>',  '<!--filtered--></i>', 'reject misplaced' );
mytest( '</i>',  '</i>',                'accept valid' );
mytest( '</I>',  '</i>',                'accept uppercase' );

sub mytest {
    my ($in, $out, $name) = @_;

    $f->input_start_document;
    $f->input_start('<i>');
    $f->input_text('foo');
    $f->input_end($in);
    $f->input_end_document;
    is( $f->filtered_document, "<i>foo$out", "input_end $name" );
}