From 87e93574a5da99b5f36751a4219caacc4e81ea3c Mon Sep 17 00:00:00 2001 From: "Heiko Schlittermann (HS12-RIPE)" Date: Thu, 3 Nov 2016 20:19:06 +0100 Subject: Testsuite: Exim::Runtest uses parent Exporter --- test/lib/Exim/Runtest.pm | 7 +++++++ test/t/00-basic.t | 12 ++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/test/lib/Exim/Runtest.pm b/test/lib/Exim/Runtest.pm index 845388b8b..851c29d3b 100644 --- a/test/lib/Exim/Runtest.pm +++ b/test/lib/Exim/Runtest.pm @@ -1,9 +1,16 @@ package Exim::Runtest; +use 5.010; use strict; use warnings; use IO::Socket::INET; use Carp; +use parent 'Exporter'; +our @EXPORT_OK = qw(mailgroup dynamic_socket); +our %EXPORT_TAGS = ( + all => \@EXPORT_OK, +); + use List::Util qw'shuffle'; =head1 NAME diff --git a/test/t/00-basic.t b/test/t/00-basic.t index f198f7af1..99a3e5fbd 100644 --- a/test/t/00-basic.t +++ b/test/t/00-basic.t @@ -3,7 +3,7 @@ use Test::Pod::Coverage; use Test::Exception; use lib 'lib'; -use_ok 'Exim::Runtest' or BAIL_OUT 'Can not load the module'; +use_ok 'Exim::Runtest', qw(:all) or BAIL_OUT 'Can not load the module'; can_ok 'Exim::Runtest', qw(mailgroup dynamic_socket); pod_coverage_ok 'Exim::Runtest' => 'docs complete'; @@ -13,18 +13,18 @@ subtest 'mailgroup' => sub { ok $group => 'got a group name'; 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'; + is mailgroup($group), $group => 'group names match'; + ok $group = mailgroup('non existing group') => 'cope with unknown 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'; + dies_ok { mailgroup(22) } 'dies on numeric group'; + dies_ok { mailgroup() } 'dies on missing default group'; }; subtest 'dynamic_socket' => sub { - ok my $socket = Exim::Runtest::dynamic_socket() => 'got a socket'; + ok my $socket = dynamic_socket() => 'got a socket'; note "got socket on port @{[$socket->sockport]}"; isa_ok $socket => 'IO::Socket::INET'; cmp_ok $socket->sockport(), '>=', 1024 => 'port is >= 1024'; -- cgit v1.2.3