File: 40.redirect.t

package info (click to toggle)
libwww-wikipedia-perl 2.05-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 248 kB
  • sloc: perl: 1,577; makefile: 4
file content (25 lines) | stat: -rw-r--r-- 664 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
use strict;
use warnings;

use Test::More tests => 4;
use WWW::Wikipedia;

# the use of 'Systems Theory' over time may need to change
my $q    = 'Systems Theory';
my $wiki = WWW::Wikipedia->new();

# test to make sure redirects in content are followed
{
    my $entry = $wiki->search( $q );
    isa_ok $entry, 'WWW::Wikipedia::Entry';
    unlike $entry->text(), qr/REDIRECT/, 'redirect not found';
}

# test to make sure redirects in content are not followed
# when follow_redirects == 0
{
    $wiki->follow_redirects( 0 );
    my $entry = $wiki->search( $q );
    isa_ok $entry, 'WWW::Wikipedia::Entry';
    like $entry->text(), qr/REDIRECT/, 'redirect found';
}