diff options
author | Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> | 2016-11-03 10:15:16 +0100 |
---|---|---|
committer | Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> | 2016-11-03 10:15:16 +0100 |
commit | b1227303735a346c79fd0734c9efb5d13609ad55 (patch) | |
tree | f5932b85100a5e9b890ba8b4484e5eec05f9afa2 | |
parent | 100122504d03e5583b8321f939d4f688ab16886c (diff) |
Testsuite: Add more tests to Exim::Runtest tests
-rw-r--r-- | test/lib/Exim/Runtest.pm | 2 | ||||
-rw-r--r-- | test/t/00-basic.t | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/test/lib/Exim/Runtest.pm b/test/lib/Exim/Runtest.pm index e60fce1e6..845388b8b 100644 --- a/test/lib/Exim/Runtest.pm +++ b/test/lib/Exim/Runtest.pm @@ -23,7 +23,7 @@ for the F<runtest> script. No functions are exported yet. =cut sub mailgroup { - my $group = shift; + my $group = shift // croak "Need a default group name."; croak "Need a group *name*, not a numeric group id." if $group =~ /^\d+$/; diff --git a/test/t/00-basic.t b/test/t/00-basic.t index af7414aa2..f198f7af1 100644 --- a/test/t/00-basic.t +++ b/test/t/00-basic.t @@ -1,24 +1,31 @@ use Test::More; +use Test::Pod::Coverage; +use Test::Exception; + use lib 'lib'; use_ok 'Exim::Runtest' or BAIL_OUT 'Can not load the module'; can_ok 'Exim::Runtest', qw(mailgroup dynamic_socket); +pod_coverage_ok 'Exim::Runtest' => 'docs complete'; subtest 'mailgroup' => sub { my $group = getgrgid $(; ok $group => 'got a group name'; - diag "use group $group"; + note "use group $group"; is Exim::Runtest::mailgroup($group), $group => 'group names match'; ok $group = Exim::Runtest::mailgroup('non existing group') => 'cope with unknown group'; - diag "got random group: $group"; + note "got random group: $group"; ok getgrnam($group) => 'got an existing group'; + + dies_ok { Exim::Runtest::mailgroup(22) } 'dies on numeric group'; + dies_ok { Exim::Runtest::mailgroup() } 'dies on missing default group'; }; subtest 'dynamic_socket' => sub { ok my $socket = Exim::Runtest::dynamic_socket() => 'got a socket'; - diag "got socket on port @{[$socket->sockport]}"; + note "got socket on port @{[$socket->sockport]}"; isa_ok $socket => 'IO::Socket::INET'; cmp_ok $socket->sockport(), '>=', 1024 => 'port is >= 1024'; $socket->close; |