diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-05 18:06:47 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-05 19:32:42 +1300 |
commit | 7969bce43d9c445d87a68080587298728d0d3e38 (patch) | |
tree | 6b0564dda9aecf08e3d465e4c52efb13984af419 /xt | |
parent | Add Module::Starter boilerplate for perlmodding (diff) | |
download | Mail-Run-Crypt-7969bce43d9c445d87a68080587298728d0d3e38.tar.gz Mail-Run-Crypt-7969bce43d9c445d87a68080587298728d0d3e38.zip |
Rename/separate out into app and module
This still needs a lot more work before release. In particular, I have
to figure out what I'm going to do about the `passphrase` option. It's
probably better to both not require it, in which case no signing is done
(only encryption), and to instead allow a path to a file to be
specified.
The other big puzzle would be how on earth to write automated tests for
it... I may end up imitating however Mail::GnuPG is testing itself.
Diffstat (limited to 'xt')
-rw-r--r-- | xt/boilerplate.t | 57 | ||||
-rw-r--r-- | xt/manifest.t | 15 | ||||
-rw-r--r-- | xt/pod-coverage.t | 24 | ||||
-rw-r--r-- | xt/pod.t | 16 |
4 files changed, 55 insertions, 57 deletions
diff --git a/xt/boilerplate.t b/xt/boilerplate.t deleted file mode 100644 index 4a007ec..0000000 --- a/xt/boilerplate.t +++ /dev/null @@ -1,57 +0,0 @@ -#!perl -T -use 5.006; -use strict; -use warnings; -use Test::More; - -plan tests => 3; - -sub not_in_file_ok { - my ($filename, %regex) = @_; - open( my $fh, '<', $filename ) - or die "couldn't open $filename for reading: $!"; - - my %violated; - - while (my $line = <$fh>) { - while (my ($desc, $regex) = each %regex) { - if ($line =~ $regex) { - push @{$violated{$desc}||=[]}, $.; - } - } - } - - if (%violated) { - fail("$filename contains boilerplate text"); - diag "$_ appears on lines @{$violated{$_}}" for keys %violated; - } else { - pass("$filename contains no boilerplate text"); - } -} - -sub module_boilerplate_ok { - my ($module) = @_; - not_in_file_ok($module => - 'the great new $MODULENAME' => qr/ - The great new /, - 'boilerplate description' => qr/Quick summary of what the module/, - 'stub function definition' => qr/function[12]/, - ); -} - -TODO: { - local $TODO = "Need to replace the boilerplate text"; - - not_in_file_ok(README => - "The README is used..." => qr/The README is used/, - "'version information here'" => qr/to provide version information/, - ); - - not_in_file_ok(Changes => - "placeholder date/time" => qr(Date/time) - ); - - module_boilerplate_ok('lib/Mail/Cron/Crypt.pm'); - - -} - diff --git a/xt/manifest.t b/xt/manifest.t new file mode 100644 index 0000000..e0b558e --- /dev/null +++ b/xt/manifest.t @@ -0,0 +1,15 @@ +#!perl -T +use 5.006; +use strict; +use warnings; +use Test::More; + +unless ( $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} + +my $min_tcm = 0.9; +eval "use Test::CheckManifest $min_tcm"; +plan skip_all => "Test::CheckManifest $min_tcm required" if $@; + +ok_manifest(); diff --git a/xt/pod-coverage.t b/xt/pod-coverage.t new file mode 100644 index 0000000..f5728a5 --- /dev/null +++ b/xt/pod-coverage.t @@ -0,0 +1,24 @@ +#!perl -T +use 5.006; +use strict; +use warnings; +use Test::More; + +unless ( $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} + +# Ensure a recent version of Test::Pod::Coverage +my $min_tpc = 1.08; +eval "use Test::Pod::Coverage $min_tpc"; +plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" + if $@; + +# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, +# but older versions don't recognize some common documentation styles +my $min_pc = 0.18; +eval "use Pod::Coverage $min_pc"; +plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" + if $@; + +all_pod_coverage_ok(); diff --git a/xt/pod.t b/xt/pod.t new file mode 100644 index 0000000..4d3a0ce --- /dev/null +++ b/xt/pod.t @@ -0,0 +1,16 @@ +#!perl -T +use 5.006; +use strict; +use warnings; +use Test::More; + +unless ( $ENV{RELEASE_TESTING} ) { + plan( skip_all => "Author tests not required for installation" ); +} + +# Ensure a recent version of Test::Pod +my $min_tp = 1.22; +eval "use Test::Pod $min_tp"; +plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; + +all_pod_files_ok(); |