File: ticket-71677.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 (25 lines) | stat: -rw-r--r-- 623 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
#!/usr/bin/perl
use Test::More tests => 2;
use MIME::Parser;

my $msg = <<'EOF';
From: <devnull@example.com>
To: <devnull@example.com>
Subject: Weird filename test
MIME-Version: 1.0
Content-Type: application/octet-stream; name="[wookie].bin"
Content-Disposition: attachment; filename="[wookie].bin"

Wookie
EOF

my $parser = MIME::Parser->new();
$parser->output_to_core(0);
$parser->output_under("testout");
my $entity = $parser->parse_data($msg);
my $body = $entity->bodyhandle;
my $path = $body->path;
ok(defined($path), 'Path exists');
ok($path =~ /_wookie_\.bin$/, 'And has the expected form');

$parser->filer->purge;