|
| 1 | +# -*- indent-tabs-mode: nil; -*- |
| 2 | +# vim:ft=perl:et:sw=4 |
| 3 | + |
| 4 | +use strict; |
| 5 | +use warnings; |
| 6 | +use English qw(no_match_vars); |
| 7 | +use Test::More; |
| 8 | + |
| 9 | +require 'mhopt.pl'; |
| 10 | +require 'readmail.pl'; |
| 11 | +require 'ewhutil.pl'; # for htmlize() |
| 12 | +# Dummies for tests |
| 13 | +sub mhonarc::dir_create {1} |
| 14 | +sub mhonarc::file_temp { my $x; open my $fh, '>', \$x; return ($fh, '') } |
| 15 | +sub mhonarc::file_chmod {1} |
| 16 | + |
| 17 | +mhonarc::mhinit_readmail_vars(); |
| 18 | + |
| 19 | +my @tests = map { [split /\n[.]\n/, $_] } split /\n[.][.]\n*/, |
| 20 | + do { local $RS; <DATA> }; |
| 21 | + |
| 22 | +foreach my $test (@tests) { |
| 23 | + my ($name, $mesg, $result) = @$test; |
| 24 | + my ($fields, $header_txt) = readmail::MAILread_header(\$mesg); |
| 25 | + my ($ret, @files) = readmail::MAILread_body($fields, \$mesg); |
| 26 | + |
| 27 | + ok $ret =~ /$result/, $name; |
| 28 | + diag "Returned:\n$ret" unless $ret =~ /$result/; |
| 29 | +} |
| 30 | + |
| 31 | +done_testing(); |
| 32 | + |
| 33 | +__END__ |
| 34 | +GH#16: Content-Description fields are omitted with inline images |
| 35 | +. |
| 36 | +Content-type: image/jpeg; name="image.jpg" |
| 37 | +Content-Description: This is a JPEG file |
| 38 | +Content-Disposition: inline; filename="image.jpg" |
| 39 | +Content-transfer-encoding: base64 |
| 40 | +
|
| 41 | +XXXX |
| 42 | +
|
| 43 | +. |
| 44 | +This is a JPEG file |
| 45 | +.. |
| 46 | +GH#16: Content-Description fields are omitted with inline images |
| 47 | +. |
| 48 | +Content-type: image/jpeg; name="image.jpg" |
| 49 | +Content-Description: This is a JPEG file |
| 50 | +Content-Disposition: attachment; filename="image.jpg" |
| 51 | +Content-transfer-encoding: base64 |
| 52 | +
|
| 53 | +XXXX |
| 54 | +
|
| 55 | +. |
| 56 | +This is a JPEG file |
| 57 | +.. |
| 58 | +
|
0 commit comments