From cb5390134daeddaf755d8cc19c3fecc81ef8f209 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 18 Oct 2017 12:02:59 +1300 Subject: Add more tests, bump version This is still really only testing that the object constructed in the right way and is providing the expected interface and internals as functions. It needs to actually run as much as possible. I still have to figure out how to mock that up cleanly. --- Changes | 11 +++++++++-- MANIFEST | 2 +- Makefile.PL | 2 +- README.markdown | 6 +++--- bin/runcrypt | 2 +- lib/Mail/Run/Crypt.pm | 8 ++++---- t/encrypt.t | 27 +++++++++++++++++++++++++++ t/instantiate.t | 15 --------------- t/require-mailto.t | 2 +- 9 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 t/encrypt.t delete mode 100644 t/instantiate.t diff --git a/Changes b/Changes index b41333c..d91c1b0 100644 --- a/Changes +++ b/Changes @@ -1,7 +1,14 @@ Revision history for Perl module Mail::Run::Crypt -This project began life as a monolithic Perl script. It does much the same -thing now but it's refactored out into an application and a module. +This project began life as a monolithic Perl script. It does much the +same thing now but it's refactored out into an application and a module. + +0.06 2017-10-18 + + - Expand test suite's test of constructed object's state. Much more + work is still needed as I figure out how to mock up the object + interfaces required without spraying email everywhere or requiring + system commands to be run. 0.05 2017-10-15 diff --git a/MANIFEST b/MANIFEST index e58e238..fe7fd55 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5,7 +5,7 @@ LICENSE Makefile.PL MANIFEST README -t/instantiate.t +t/encrypt.t t/require-mailto.t xt/manifest.t xt/pod-coverage.t diff --git a/Makefile.PL b/Makefile.PL index 9132104..bd7da21 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -31,7 +31,7 @@ WriteMakefile( 'meta-spec' => { version => 2 }, provides => { 'Mail::Run::Crypt' => { - version => '0.05', + version => '0.06', file => 'lib/Mail/Run/Crypt.pm', }, }, diff --git a/README.markdown b/README.markdown index 765fec9..eba1ce8 100644 --- a/README.markdown +++ b/README.markdown @@ -4,7 +4,7 @@ Mail::Run::Crypt - Encrypt and mail output from command runs # VERSION -Version 0.05 +Version 0.06 # DESCRIPTION @@ -145,8 +145,8 @@ it won't work with other OpenPGP implementations. # BUGS AND LIMITATIONS -Definitely. This code is not production-ready. In particular, there is almost -no test suite. +Definitely. This code is not production-ready. The test suite coverage is still +not great, but should improve in newer versions. # AUTHOR diff --git a/bin/runcrypt b/bin/runcrypt index f00c472..d268385 100755 --- a/bin/runcrypt +++ b/bin/runcrypt @@ -17,7 +17,7 @@ use Getopt::Long::Descriptive; use Mail::Run::Crypt; # Specify package version -our $VERSION = '0.05'; +our $VERSION = '0.06'; # Name ourselves our $SELF = 'runcrypt'; diff --git a/lib/Mail/Run/Crypt.pm b/lib/Mail/Run/Crypt.pm index e3210fd..5669f1d 100644 --- a/lib/Mail/Run/Crypt.pm +++ b/lib/Mail/Run/Crypt.pm @@ -16,7 +16,7 @@ use Mail::GnuPG; use MIME::Entity; # Specify package verson -our $VERSION = '0.05'; +our $VERSION = '0.06'; # Default exit value our $DEFAULT_EXIT = 127; ## no critic (ProhibitMagicNumbers) @@ -138,7 +138,7 @@ Mail::Run::Crypt - Encrypt and mail output from command runs =head1 VERSION -Version 0.05 +Version 0.06 =head1 DESCRIPTION @@ -307,8 +307,8 @@ it won't work with other OpenPGP implementations. =head1 BUGS AND LIMITATIONS -Definitely. This code is not production-ready. In particular, there is almost -no test suite. +Definitely. This code is not production-ready. The test suite coverage is still +not great, but should improve in newer versions. =head1 AUTHOR diff --git a/t/encrypt.t b/t/encrypt.t new file mode 100644 index 0000000..2248579 --- /dev/null +++ b/t/encrypt.t @@ -0,0 +1,27 @@ +#!perl -T + +use strict; +use warnings; +use utf8; + +use Test::More tests => 12; + +use Mail::Run::Crypt; + +our $VERSION = '0.06'; + +my $mrc = Mail::Run::Crypt->new( mailto => 'nobody@example.com' ); + +my $pkg = 'Mail::Run::Crypt'; +ok( defined $mrc, 'constructed' ); +isa_ok( $mrc, $pkg ); +can_ok( $pkg, 'run' ); +can_ok( $pkg, 'bail' ); +can_ok( $pkg, '_mail' ); +ok( $mrc->bail == $Mail::Run::Crypt::DEFAULT_EXIT, 'bail_default_exit' ); +ok( $mrc->{mailto} eq 'nobody@example.com', 'mailto_set' ); +ok( $mrc->{encrypt} == 1, 'encrypt_on' ); +ok( $mrc->{sign} == 0, 'sign_off' ); +ok( $mrc->{name} eq 'Mail::Run::Crypt', 'default_name' ); +ok( !defined $mrc->{keyid}, 'keyid unset' ); +ok( !defined $mrc->{passphrase}, 'passphrase unset' ); diff --git a/t/instantiate.t b/t/instantiate.t deleted file mode 100644 index 6a55fe0..0000000 --- a/t/instantiate.t +++ /dev/null @@ -1,15 +0,0 @@ -#!perl -T - -use strict; -use warnings; -use utf8; - -use Test::More tests => 1; - -use Mail::Run::Crypt; - -our $VERSION = '0.05'; - -my $mrc = Mail::Run::Crypt->new( mailto => 'nobody@example.com' ); - -isnt( $mrc, undef, 'instantiate' ); diff --git a/t/require-mailto.t b/t/require-mailto.t index 9298cec..1f36e3d 100644 --- a/t/require-mailto.t +++ b/t/require-mailto.t @@ -9,7 +9,7 @@ use Test::More tests => 2; use Mail::Run::Crypt; -our $VERSION = '0.05'; +our $VERSION = '0.06'; my $mrc; my $error; -- cgit v1.2.3