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
|
use strict;
use warnings;
use Test::More tests => 5;
use MIME::Field::ContType;
# Trivial test
{
my $field = Mail::Field->new('Content-type');
isa_ok( $field, 'MIME::Field::ParamVal');
isa_ok( $field, 'Mail::Field');
$field->param('_', 'stuff');
$field->param('answer', 42);
is( $field->stringify, 'stuff; answer="42"', 'Object stringified to expected value');
}
# Test for CPAN RT #34451
{
my $header = 'stuff; answer*=%FE%20%FF';
my $field = Mail::Field->new('Content-type');
$field->parse( $header );
is( $field->param('_'), 'stuff', 'Got body of header');
my $expected = pack('C', 0xfe) . ' ' . pack('C', 0xff);
is( $field->param('answer'), $expected, 'answer param was unpacked correctly');
}
|