From 41a71f5d79836ea45cfd3db54b5461e5bad21d40 Mon Sep 17 00:00:00 2001 From: Jared Johnson Date: Fri, 12 Sep 2014 13:09:20 -0500 Subject: [PATCH] Move test sub definition to the bottom --- t/qpsmtpd-address.t | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/t/qpsmtpd-address.t b/t/qpsmtpd-address.t index 6344cf3..d971204 100644 --- a/t/qpsmtpd-address.t +++ b/t/qpsmtpd-address.t @@ -13,20 +13,6 @@ use_ok('Test::Qpsmtpd'); __config(); -sub __config { - ok( my ($qp,$cxn) = Test::Qpsmtpd->new_conn(), "get new connection" ); - ok( $qp->command('HELO test') ); - ok( $qp->command('MAIL FROM:') ); - my $sender = $qp->transaction->sender; - $qp->hooks->{user_config} = undef; - is( $qp->config('size_threshold'), 10000, 'use global config when user_config is absent' ); - is( $sender->config('test config'), undef, 'no user_config plugins exist' ); - $qp->hooks->{user_config} = [{ name => 'test hook', code => sub { return DECLINED } }]; - is( $sender->config('test config'), undef, 'no user_config plugins return OK' ); - $qp->hooks->{user_config} = [{ name => 'test hook', code => sub { return OK, 'test data' } }]; - is( $sender->config('test config'), 'test data', 'user_config plugins return a value' ); -} - __new(); __parse(); @@ -135,3 +121,17 @@ sub __parse { is($ao && $ao->address, $as, "address $as"); ok($ao eq $as, "overloaded 'cmp' operator"); }; + +sub __config { + ok( my ($qp,$cxn) = Test::Qpsmtpd->new_conn(), "get new connection" ); + ok( $qp->command('HELO test') ); + ok( $qp->command('MAIL FROM:') ); + my $sender = $qp->transaction->sender; + $qp->hooks->{user_config} = undef; + is( $qp->config('size_threshold'), 10000, 'use global config when user_config is absent' ); + is( $sender->config('test config'), undef, 'no user_config plugins exist' ); + $qp->hooks->{user_config} = [{ name => 'test hook', code => sub { return DECLINED } }]; + is( $sender->config('test config'), undef, 'no user_config plugins return OK' ); + $qp->hooks->{user_config} = [{ name => 'test hook', code => sub { return OK, 'test data' } }]; + is( $sender->config('test config'), 'test data', 'user_config plugins return a value' ); +}