File: errors.t

package info (click to toggle)
libemail-send-perl 2.198-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 300 kB
  • ctags: 76
  • sloc: perl: 523; makefile: 8
file content (33 lines) | stat: -rw-r--r-- 830 bytes parent folder | download | duplicates (4)
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
use Test::More tests => 7;
use strict;
$^W = 1;

use lib 't/lib';

BEGIN { use_ok('Email::Send', 'Test'); }

{ # undef message
  my $rv = send;
  ok(!$rv, "sending with no message is false");
  like("$rv", qr/no message found/i, "correct error message");
}

{ # broken mailers in mailer_available
  { # mailer module that won't load
    my $sender = Email::Send->new;

    my $rv = $sender->mailer_available("Test::Email::Send::Won't::Exist");
    
    ok(!$rv, "failed to load mailer (doesn't exist)"),
    like("$rv", qr/can't locate/i, "and got correct exception");
  }

  { # mailer module that won't load
    my $sender = Email::Send->new;

    my $rv = $sender->mailer_available("BadMailer");
    
    ok(!$rv, "failed to load mailer BadMailer"),
    like("$rv", qr/doesn't report avail/i, "and got correct failure");
  }
}