File: ParamVal.t

package info (click to toggle)
libmime-tools-perl 5.428-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,604 kB
  • ctags: 525
  • sloc: perl: 6,454; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 718 bytes parent folder | download | duplicates (3)
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');
}