File: header-new.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 (34 lines) | stat: -rw-r--r-- 706 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
34
use strict;

use Test::More tests => 7;

# This test could test all manner of Email::Simple::Header stuff, but is mostly
# just here specifically to test construction and sanity of result with both a
# string AND a reference to it. -- rjbs, 2006-11-29

BEGIN { use_ok('Email::Simple::Header'); }

my $header_string = <<'END_HEADER';
Foo: 1
Foo: 2
Bar: 3
Baz: 1
END_HEADER

for my $header_param ($header_string, \$header_string) {
  my $head = Email::Simple::Header->new($header_param);

  isa_ok($head, 'Email::Simple::Header');

  is_deeply(
    [ $head->header('foo') ],
    [ 1, 2 ],
    "multi-value header",
  );

  is_deeply(
    scalar $head->header('foo'),
    1,
    "single-value header",
  );
}