use Test::More tests => 41; BEGIN { use_ok('HTML::Obliterate') }; my $str = q{

hello world

}; my $arr = [$str, "howdy", q{
}]; ok(HTML::Obliterate::remove_html($str) eq 'hello world', 'remove_html str'); my $new = HTML::Obliterate::remove_html($arr); ok($new->[0] eq 'hello world', 'remove_html arr chg 1'); ok($new->[1] eq 'howdy', 'remove_html arr chg 2'); ok($new->[2] eq '', 'remove_html str arr chg 3'); ok($arr->[0] ne 'hello world', 'remove_html arr no chg 1'); ok($arr->[1] eq 'howdy', 'remove_html arr no chg 2'); ok($arr->[2] ne '', 'remove_html str arr no chg 3'); HTML::Obliterate::remove_html($arr); ok($arr->[0] eq 'hello world', 'remove_html arr void chg'); ok($arr->[1] eq 'howdy', 'remove_html arr void chg 2'); ok($arr->[2] eq '', 'remove_html str arr void chg 3'); ok(HTML::Obliterate::extirpate_html($str) eq 'hello world', 'alias test'); ok(HTML::Obliterate::remove_html_from_string(qq{

hello\nworld

}) eq "hello\nworld", 'multi line string'); ok(HTML::Obliterate::remove_html_from_string(qq{hello\nworld

}) eq "hello\nworld", 'multi line tag'); my %ent = ( 'Hello' => '<Hello>', "\nHello\n\n" => "<\nHello\n>\n", 'Hello ' => '<Hello> &n;', '&;' => '&;', 'hi' => 'Žhi&there;', '& quot ;' => '& quot ;', '& l t' => '& l t', '& gt' => '& gt', "\n;" => "<\n;", '' => '<>', 'ab' => 'a<>>b', 'lajde' => 'l>>d>ajde', 'xy' => 'xy', 'comment w/ HTML' => 'comment w/ HTML', 'comment x comment' => 'comment x comment', 'test' => 'test', 'foobar' => 'foo
bar', 'test 1' => '

test 1

', # w/ attribute 'test 2' => '

">test 3

', # attribute w/ unescaped html 'bar' => 'bar', 'baz' => 'baz', 'baz 2' => 'baz 2', 'bar 2' => 'a > bbar 2', # attribute w/ '>' 'zib' => '<# just data #>zib', # doesn't take out tag contents since it doesn't parse the HTML into a struvture 'if (ac)tag section' => 'tag section', 'jaz' => '>>>>>>>>>>> ]]>jaz', ); my $cnt = 0; for my $key (sort keys %ent) { $cnt++; my $res = HTML::Obliterate::remove_html_from_string($ent{$key}); diag "'$res' should be $key" if $res ne $key; ok($res eq $key, "HTML entity $cnt"); }