"Fossies" - the Fresh Open Source Software Archive

Member "email-reminder-0.8.1/t/messages.t" (11 Sep 2020, 1811 Bytes) of package /linux/privat/email-reminder-0.8.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "messages.t": 0.7.7_vs_0.7.8.

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 use warnings;
    5 
    6 use Test::More tests => 12;
    7 use EmailReminder::EventList;
    8 
    9 my $salutation = 'Hi there,
   10 
   11 ';
   12 my $footer = 'Have a good day!
   13 
   14 --
   15 Sent by Email-Reminder '.$EmailReminder::Utils::VERSION.'
   16 https://launchpad.net/email-reminder
   17 ';
   18 
   19 my @strs = (
   20 'I just want to remind you of the following event :
   21 
   22 5-a-side
   23 
   24 ',
   25 'I just want to remind you of the following event :
   26 
   27 5-a-side
   28 
   29 ',
   30 'I just want to remind you of the following event :
   31 
   32 Christmas Day
   33 
   34 ',
   35 'I just want to remind you of the following event :
   36 
   37 8th New Year\'s Day
   38 
   39 ',
   40 'I just want to remind you that the 14th anniversary (Ivory) of My Sister and Bro in Law is .
   41 
   42 You can reach My Sister at sis.bro-in-law@exmaple.org.
   43 
   44 ',
   45 'I just want to remind you that the 18th anniversary of My Brother and Sis in Law is .
   46 
   47 You can reach them at bro.sis-in-law@example.com and sis-in-law@example.com respectively.
   48 
   49 ',
   50 'I just want to remind you of the following event :
   51 
   52 PayDay
   53 
   54 ',
   55 'I just want to remind you of the following event :
   56 
   57 Clean the House
   58 
   59 ',
   60 'I just want to remind you that Sister is turning 35 .
   61 
   62 You can reach Sister at sister@example.org.
   63 
   64 ',
   65 'I just want to remind you that Bro is turning 38 .
   66 
   67 You can reach Bro at bro@example.org.
   68 
   69 ',
   70 'I just want to remind you that Friend is turning 39 .
   71 
   72 You can reach Friend at friend@example.com.
   73 
   74 ',
   75 );
   76 
   77 for (my $i=0; $i < scalar(@strs); $i++) {
   78     $strs[$i] = $salutation . $strs[$i] . $footer;
   79 }
   80 
   81 # tests
   82 my $events = EmailReminder::EventList->new('t/data.xml', 1);
   83 
   84 # loop through all the events themselves
   85 foreach my $event ($events->get_events()) {
   86     my $msg = $event->get_message;
   87     my ($i) = grep { $strs[$_] eq $msg } 0..$#strs;
   88     splice (@strs, $i, 1) if defined($i);
   89     ok(defined($i), "event msg ($i)");
   90 }
   91 is(scalar @strs, 0, "all messages were found");