1#!/usr/bin/perl
2use Test::More tests => 2;
3use MIME::Parser;
4
5my $msg = <<'EOF';
6From: <devnull@example.com>
7To: <devnull@example.com>
8Subject: Weird filename test
9MIME-Version: 1.0
10Content-Type: application/octet-stream; name="[wookie].bin"
11Content-Disposition: attachment; filename="[wookie].bin"
12
13Wookie
14EOF
15
16my $parser = MIME::Parser->new();
17$parser->output_to_core(0);
18$parser->output_under("testout");
19my $entity = $parser->parse_data($msg);
20my $body = $entity->bodyhandle;
21my $path = $body->path;
22ok(defined($path), 'Path exists');
23ok($path =~ /_wookie_\.bin$/, 'And has the expected form');
24
25$parser->filer->purge;
26