File: rt79044_multiple.t

package info (click to toggle)
libhtml-scrubber-perl 0.11-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 296 kB
  • ctags: 38
  • sloc: perl: 673; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (6)
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
29
30
31
32
33
# rt79044_multiple.t

# this is to test for the problem described in RT #79044

use strict;
use Test::More;

use_ok('HTML::Scrubber');

use HTML::Scrubber;
my @allow    = qw[ p ];
my $scrubber = HTML::Scrubber->new();
$scrubber->allow(@allow);

ok( $scrubber, "got scrubber" );

# all of these should go through unscathed
my @data = ( '<p>one</p>', '<p>two</p>', '<p>three</p>', '<p>four</p>' );

foreach my $datum (@data) {
    is( $scrubber->scrub($datum), $datum, 'Test unscathed' );
}

# now do the same thing again, this time not allowing a <p> tag
$scrubber->allow();

foreach my $datum (@data) {
    my $result = $datum;
    $datum =~ s|</?p>||g;    # strip with regexp - yay!
    is( $scrubber->scrub($datum), $datum, 'Test processed' );
}

done_testing;