require Mail::Header; print "1..22\n"; $h = new Mail::Header; $t = 0; $h->header_hashref({hhrtest1 => 1, hhrtest2 => [1, "this test line was written by TobiX\n"]}); $h->add(Date => "a test header"); $h->add(Date => "a longer test header"); $h->add(Date => "an even longer test header"); $h->print; $str = $h->get(Date => 0); print "#$str#\nnot " unless $str eq "a test header\n"; printf "ok %d\n",++$t; $str = $h->get(Date => 1); print "#$str#\nnot " unless $str eq "a longer test header\n"; printf "ok %d\n",++$t; $str = $h->get(Date => 2); print "#$str#\nnot " unless $str eq "an even longer test header\n"; printf "ok %d\n",++$t; $str = $h->get('hhrtest2',1); print "#$str#\nnot " unless $str eq "this test line was written by TobiX\n"; printf "ok %d\n",++$t; $href=$h->header_hashref(); print "not " unless $href->{Date}->[0] eq "a test header\n"; printf "ok %d\n",++$t; print "not " unless $href->{Hhrtest2}->[0]; printf "ok %d\n",++$t; print "not " unless $href->{Hhrtest1}->[0]; printf "ok %d\n",++$t; $h->fold(30); print "not " unless $h->get(Date => 0) eq "a test header\n"; printf "ok %d\n",++$t; print "not " unless $h->get(Date => 1) eq "a longer test header\n"; printf "ok %d\n",++$t; print "not " unless $h->get(Date => 2) eq "an even longer test\n header\n"; printf "ok %d\n",++$t; $h->fold(20); print "not " unless $h->get(Date => 0) eq "a test header\n"; printf "ok %d\n",++$t; print "not " unless $h->get(Date => 1) eq "a longer\n test header\n"; printf "ok %d\n",++$t; print "not " unless $h->get(Date => 2) eq "an even\n longer test\n header\n"; printf "ok %d\n",++$t; $h->unfold; print "not " unless $h->get(Date => 0) eq "a test header\n"; printf "ok %d\n",++$t; print "not " unless $h->get(Date => 1) eq "a longer test header\n"; printf "ok %d\n",++$t; print "not " unless $h->get(Date => 2) eq "an even longer test header\n"; printf "ok %d\n",++$t; $head = < 0; printf "ok %d\n",++$t; print "not " unless $h->as_string eq $head; printf "ok %d\n",++$t; print "not " unless $h->get('Subject') eq "subject\n"; printf "ok %d\n",++$t; print "not " unless $h->get('To') eq "to\n"; printf "ok %d\n",++$t; $headin = < 1; printf "ok %d\n",++$t; print $h->as_string,"\n----\n",$headout,"\nnot " unless $h->as_string eq $headout; printf "ok %d\n",++$t;