File: ticket-41632.t

package info (click to toggle)
libmime-tools-perl 5.515-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,612 kB
  • sloc: perl: 6,349; makefile: 8
file content (30 lines) | stat: -rw-r--r-- 1,334 bytes parent folder | download | duplicates (7)
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 => 6;

# Handle the case of both RFC-2231 and non-RFC-2231 parameter values.
# In this case, we ignore the non-RFC-2231 parameters

use MIME::Field::ParamVal;
use MIME::WordDecoder;

my $params;

my $wd = supported MIME::WordDecoder 'UTF-8';
$params = MIME::Field::ParamVal->parse_params('inline; filename="foo"; filename*1="ar"; filename*0="b"');

is($params->{'_'}, 'inline', 'Got the "inline" right');
is($wd->decode($params->{'filename'}), 'bar', 'Ignored non-RFC-2231 value if RFC-2231 parameters are present');

$params = MIME::Field::ParamVal->parse_params('inline; filename="foo"');
is($wd->decode($params->{'filename'}), 'foo', 'Got filename if RFC-2231 parameters are absent');

$params = MIME::Field::ParamVal->parse_params('inline; filename*1="ar"; filename*0="b"');
is($wd->decode($params->{'filename'}), 'bar', 'Got RFC-2231 value');

$params = MIME::Field::ParamVal->parse_params('inline; filename*1="ar"; filename="foo"; filename*0="b"');
is($wd->decode($params->{'filename'}), 'bar', 'Ignored non-RFC-2231 value if RFC-2231 parameters are present');

$params = MIME::Field::ParamVal->parse_params('inline; filename*1="ar"; filename*0="b"; filename="foo"');
is($wd->decode($params->{'filename'}), 'bar', 'Ignored non-RFC-2231 value if RFC-2231 parameters are present');