Debian Codegraph @

t/data.t

raw
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4
5 use MIME::Lite;
6 use Test::More;
7
8 # Make a tester... here are 3 different alternatives:
9 $MIME::Lite::VANILLA = 1;
10 $MIME::Lite::PARANOID = 1;
11
12 my ($me, $str);
13
14 #------------------------------
15 $me = MIME::Lite->build(Type => 'text/plain',
16 Data => "Hello\nWorld\n");
17 $str = $me->as_string;
18 ok(($str =~ m{Hello\nWorld\n}), "Data string");
19
20 #------------------------------
21 $me = MIME::Lite->build(Type => 'text/plain',
22 Data => ["Hel", "lo\n", "World\n"]);
23 $str = $me->as_string;
24 ok(($str =~ m{Hello\nWorld\n}), "Data array 1");
25
26 #------------------------------
27 $me = MIME::Lite->build(Type => 'text/plain',
28 Data => ["Hel", "lo", "\n", "", "World", "", "","\n"]);
29 $str = $me->as_string;
30 ok(($str =~ m{Hello\nWorld\n}), "Data array 2");
31
32 #------------------------------
33 $me = MIME::Lite->build(Type => 'text/plain',
34 Path => "./testin/hello");
35 $str = $me->as_string;
36 ok(($str =~ m{Hello\r?\nWorld\r?\n}), "Data file");
37
38 done_testing;