Skip to content

Commit

Permalink
Merge pull request sympa-community#11 from ikedas/basic-tests by ikedas
Browse files Browse the repository at this point in the history
Adding basic tests and so on
  • Loading branch information
ikedas authored Jun 4, 2021
2 parents 6fcb76d + 32c7c4e commit fea7fa6
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 6 deletions.
9 changes: 6 additions & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
- perl -v
script:
- cpanm --installdeps --notest .
- cpanm --notest Test::Compile::Internal
- cpanm --notest CGI
- cpanm --notest Unicode::String Unicode::MapUTF8
- for i in lib/*.pl lib/MHonArc/*.pm lib/MHonArc/*/*.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

Expand All @@ -37,3 +38,5 @@
<<: *job
"5.30":
<<: *job
"5.32":
<<: *job
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: perl

perl:
- "5.32"
- "5.30"
- "5.28"
- "5.26"
Expand All @@ -21,11 +22,12 @@ before_script:

script:
- cpanm --installdeps --notest .
- cpanm --notest Test::Compile::Internal
- cpanm --notest CGI
- cpanm --notest Unicode::String Unicode::MapUTF8
- for i in lib/*.pl lib/MHonArc/*.pm lib/MHonArc/*/*.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
4 changes: 4 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,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
38 changes: 38 additions & 0 deletions MANIFEST.SKIP
Original file line number Diff line number Diff line change
@@ -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$

5 changes: 5 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ WriteMakefile(
}
},
prereqs => {
build => {
requires => {
'Test::Compile::Internal' => 0,
},
},
runtime => {
recommends => {
'Digest::MD5' => 0,
Expand Down
20 changes: 20 additions & 0 deletions t/compile.t
Original file line number Diff line number Diff line change
@@ -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::Internal';
$Test::Compile::Internal::VERSION or plan skip_all => 'Test::Compile::Internal required';
}

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};
$test->all_files_ok(qw{contrib examples lib});

done_testing();

41 changes: 41 additions & 0 deletions t/readmail-MAILhead_get_disposition.t
Original file line number Diff line number Diff line change
@@ -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; <DATA> };

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__
Savannah#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
..

0 comments on commit fea7fa6

Please sign in to comment.