File: 25.search_error.t

package info (click to toggle)
libwww-wikipedia-perl 2.00-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 236 kB
  • ctags: 132
  • sloc: perl: 1,507; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 444 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
use strict;
use warnings;
use Test::More tests => 3;

package WWW::Wikipedia;

use HTTP::Response;

sub get {
    return HTTP::Response->new( 500 );
}

package main;

use WWW::Wikipedia;

# test default language
my $wiki = WWW::Wikipedia->new();
isa_ok( $wiki, 'WWW::Wikipedia' );

my $entry = $wiki->search( 'perl' );
is( $entry, undef, 'search() returns undef' );
like( $wiki->error, qr/^uhoh, WWW::Wikipedia unable to contact/, 'error()' );