From 9c7481a0f3fa6e8627fcf951eab513bc1c6534ed Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Wed, 23 Sep 2020 12:06:11 +0900 Subject: [PATCH 1/6] Adding some basic test cases --- t/compile.t | 20 +++++++++++++ t/readmail-MAILhead_get_disposition.t | 41 +++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100755 t/compile.t create mode 100644 t/readmail-MAILhead_get_disposition.t diff --git a/t/compile.t b/t/compile.t new file mode 100755 index 0000000..f2ba688 --- /dev/null +++ b/t/compile.t @@ -0,0 +1,20 @@ +# -*- indent-tabs-mode: nil; -*- +# vim:ft=perl:et:sw=4 + +use strict; +use warnings; +use Test::More; + +BEGIN { + eval 'use Test::Compile'; + $Test::Compile::VERSION or plan skip_all => 'Test::Compile required'; +} + +grep { pl_file_ok $_ } + qw{mha-dbedit mha-dbrecover mha-decode mhonarc}, + qw{admin/mhaadmin.cgi extras/mha-mhedit/mha-mhedit}, + all_pl_files(qw{contrib examples lib}), + all_pm_files(qw{lib}); + +done_testing(); + diff --git a/t/readmail-MAILhead_get_disposition.t b/t/readmail-MAILhead_get_disposition.t new file mode 100644 index 0000000..ebfc977 --- /dev/null +++ b/t/readmail-MAILhead_get_disposition.t @@ -0,0 +1,41 @@ +# -*- indent-tabs-mode: nil; -*- +# vim:ft=perl:et:sw=4 + +use strict; +use warnings; +use English qw(no_match_vars); +use Test::More; + +require 'mhopt.pl'; +require 'readmail.pl'; + +mhonarc::mhinit_readmail_vars(); + +my @tests = map { [split /\n[.]\n/, $_] } split /\n[.][.]\n*/, + do { local $RS; }; + +foreach my $test (@tests) { + my ($name, $mesg, $result) = @$test; + my ($fields, $header_txt) = readmail::MAILread_header(\$mesg); + my ($disp, $file, $raw, $html_name) = + readmail::MAILhead_get_disposition($fields); + + is $file, $result, $name; +} + +done_testing(); + +__END__ +bug #511: Non-ASCII encoded data is not decoded in filename disposition +. +Content-type: application/pdf; + name="=?iso-8859-1?Q?CT-564.pdf?=" +Content-Disposition: attachment; filename="=?iso-8859-1?Q?CT-564.pdf?=" +Content-transfer-encoding: base64 + +XXX + +. +CT-564.pdf +.. + From 8ba790decc2cf93b4f233140d9908f2c48abca4b Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Wed, 23 Sep 2020 12:06:49 +0900 Subject: [PATCH 2/6] Updating MANIFEST & MANIFEST.SKIP --- MANIFEST | 4 ++++ MANIFEST.SKIP | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 MANIFEST.SKIP diff --git a/MANIFEST b/MANIFEST index ca7061f..11f089f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -533,10 +533,14 @@ man/mha-dbrecover.1 man/mha-decode.1 man/mhonarc.1 MANIFEST This list of files +MANIFEST.SKIP mha-dbedit mha-dbrecover mha-decode mhonarc README.txt RELNOTES +t/compile.t +t/readmail-MAILhead_get_disposition.t TODO +xt/perltidy.t diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP new file mode 100644 index 0000000..c8cb01b --- /dev/null +++ b/MANIFEST.SKIP @@ -0,0 +1,38 @@ +# ExtUtils::MakeMaker +^MANIFEST[.]bak +^Makefile$ +^Makefile[.]old$ +^blib/ +^MakeMaker-\d +^pm_to_blib$ +^pm_to_blib[.]ts$ +^MHonArc-[.\d_]+[.]tar[.]gz$ + +# MYMETA.* files +^MYMETA[.] + +# PerlTidy +^[.]perltidyrc$ +^[.]tidyall[.]d/ + +# Git +\B[.]git\b +\B[.]gitignore\b + +# GitHub +^[.]travis[.]yml$ +^[.]github/ + +# Gitlab +^[.]gitlab-ci[.]yml$ + +# Temporary/backup files +^# +^~ +~$ +[.]bak$ +[.]old$ +[.]rej$ +[.]swp$ +[.]tmp$ + From d302687b98f5ed28f44098881ca1f015f63e1570 Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Wed, 3 Feb 2021 17:14:43 +0900 Subject: [PATCH 3/6] t/compile.t: all_pl_files() & all_pm_files() were deprecated. --- t/compile.t | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/t/compile.t b/t/compile.t index f2ba688..a61afaf 100755 --- a/t/compile.t +++ b/t/compile.t @@ -6,15 +6,15 @@ use warnings; use Test::More; BEGIN { - eval 'use Test::Compile'; - $Test::Compile::VERSION or plan skip_all => 'Test::Compile required'; + eval 'use Test::Compile::Internal'; + $Test::Compile::Internal::VERSION or plan skip_all => 'Test::Compile::Internal required'; } -grep { pl_file_ok $_ } +my $test = Test::Compile::Internal->new; +grep { ok $test->pl_file_compiles($_), "$_ compiles" } qw{mha-dbedit mha-dbrecover mha-decode mhonarc}, - qw{admin/mhaadmin.cgi extras/mha-mhedit/mha-mhedit}, - all_pl_files(qw{contrib examples lib}), - all_pm_files(qw{lib}); + qw{admin/mhaadmin.cgi extras/mha-mhedit/mha-mhedit}; +$test->all_files_ok(qw{contrib examples lib}); done_testing(); From 80950c501db8827a753ed91493637d66a4510c7d Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Fri, 4 Jun 2021 11:17:45 +0900 Subject: [PATCH 4/6] Update .travis.yml & .gitlab-ci.yml --- .gitlab-ci.yml | 7 ++++--- .travis.yml | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 90795ab..7922b35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,11 +5,10 @@ - . ~/.bash_profile - perl -v script: - - for i in lib/*.pl lib/*.pm lib/*/*.pm; do perl -Ilib -c $i; done - perl Makefile.PL - make - - make install - - make tardist + - make disttest + - make dist - cpanm -L local MHonArc-*.tar.gz - make clean @@ -35,3 +34,5 @@ <<: *job "5.30": <<: *job +"5.32": + <<: *job diff --git a/.travis.yml b/.travis.yml index 1f1e666..610af72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: perl perl: + - "5.32" - "5.30" - "5.28" - "5.26" @@ -20,10 +21,9 @@ before_script: - perl -V script: - - for i in lib/*.pl lib/*.pm lib/*/*.pm; do perl -Ilib -c $i || exit 1; done - perl Makefile.PL - make - - make install - - make tardist + - make disttest + - make dist - cpanm -L local MHonArc-*.tar.gz - make clean From 9073f089a3e0a0407e601a398495669ec3dd0760 Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Fri, 4 Jun 2021 11:32:39 +0900 Subject: [PATCH 5/6] Updating meta spec --- Makefile.PL | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.PL b/Makefile.PL index 4ff273a..51442e2 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -32,6 +32,11 @@ WriteMakefile( } }, prereqs => { + build => { + requires => { + 'Test::Compile::Internal' => 0, + }, + }, runtime => { recommends => { 'Digest::MD5' => 0, From 32c7c4e73abbe0e7389561854bc65932d326d356 Mon Sep 17 00:00:00 2001 From: IKEDA Soji Date: Fri, 4 Jun 2021 12:01:58 +0900 Subject: [PATCH 6/6] Update .travis.yml & .gitlab-ci.yml --- .gitlab-ci.yml | 2 ++ .travis.yml | 2 ++ t/readmail-MAILhead_get_disposition.t | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 273fa78..5258d5d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,8 @@ - perl -v script: - cpanm --installdeps --notest . + - cpanm --notest Test::Compile::Internal + - cpanm --notest CGI - cpanm --notest Unicode::String Unicode::MapUTF8 - perl Makefile.PL - make diff --git a/.travis.yml b/.travis.yml index 74c92ac..8509bf2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,8 @@ before_script: script: - cpanm --installdeps --notest . + - cpanm --notest Test::Compile::Internal + - cpanm --notest CGI - cpanm --notest Unicode::String Unicode::MapUTF8 - perl Makefile.PL - make diff --git a/t/readmail-MAILhead_get_disposition.t b/t/readmail-MAILhead_get_disposition.t index ebfc977..244a67a 100644 --- a/t/readmail-MAILhead_get_disposition.t +++ b/t/readmail-MAILhead_get_disposition.t @@ -26,7 +26,7 @@ foreach my $test (@tests) { done_testing(); __END__ -bug #511: Non-ASCII encoded data is not decoded in filename disposition +Savannah#511: Non-ASCII encoded data is not decoded in filename disposition . Content-type: application/pdf; name="=?iso-8859-1?Q?CT-564.pdf?="