File: 27.clean_html.t

package info (click to toggle)
libwww-wikipedia-perl 2.05-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 248 kB
  • sloc: perl: 1,577; makefile: 4
file content (19 lines) | stat: -rw-r--r-- 633 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use strict;
use warnings;
use Test::More tests => 3;
use WWW::Wikipedia;

# Text::Autoformat has had some bugs which some wikipedia content
# has been known to trigger. Make sure we cover those bases.

my $wiki = WWW::Wikipedia->new( clean_html => 1 );

my $entry = $wiki->search( 'Inequality_(mathematics)' );
# test some specific constructs that are not likely to be removed
# by wikipedia users. This is dangerous...
like $entry->text, qr/a < b/, "Less than was kept";

$entry = $wiki->search( 'Ampersand' );
unlike $entry->text, qr/<ref/, "Ref Begin tag was removed";
unlike $entry->text, qr/<\/ref/, "Ref End tag was removed";