File: unit.t

package info (click to toggle)
libemail-simple-perl 2.004-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 232 kB
  • ctags: 27
  • sloc: perl: 615; makefile: 41
file content (35 lines) | stat: -rw-r--r-- 965 bytes parent folder | download | duplicates (6)
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
34
35
#!/usr/bin/perl
# This is a series of unit tests to ensure that things do what I think
# they do.
use strict;
use Email::Simple;

package Email::Simple;
use Test::More tests => 8;

# Simple "email", no body

my $text = "a\nb\nc\n";
my ($pos, $crlf) = Email::Simple->_split_head_from_body(\$text);
is($pos, undef, "no body position!");
is($crlf, "\n", 'and \n is the crlf');

# Simple "email", properly formed

$text = "a\n\nb\n";
($pos, $crlf) = Email::Simple->_split_head_from_body(\$text);
is($pos, 3, "body starts at pos 3");
is($crlf, "\n", 'and \n is the crlf');

# Simple "email" with blank lines

$text = "a\n\nb\nc\n";
($pos, $crlf) = Email::Simple->_split_head_from_body(\$text);
is($pos, 3, "body starts at pos 3");
is($crlf, "\n", 'and \n is the crlf');

# Blank line as first line in email
$text = "a\n\n\nb\nc\n";
($pos, $crlf) = Email::Simple->_split_head_from_body(\$text);
is($pos, 3, "body starts at pos 3");
is($crlf, "\n", 'and \n is the crlf');