You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by km...@apache.org on 2018/02/05 09:11:01 UTC
svn commit: r1823143 [1/2] - in /spamassassin/trunk: ./ t/
Author: kmcgrail
Date: Mon Feb 5 09:10:59 2018
New Revision: 1823143
URL: http://svn.apache.org/viewvc?rev=1823143&view=rev
Log:
Bug 7491 switch test framework to Test::More
Modified:
spamassassin/trunk/Makefile.PL
spamassassin/trunk/t/SATest.pm
spamassassin/trunk/t/autolearn.t
spamassassin/trunk/t/autolearn_force.t
spamassassin/trunk/t/autolearn_force_fail.t
spamassassin/trunk/t/basic_lint.t
spamassassin/trunk/t/basic_lint_without_sandbox.t
spamassassin/trunk/t/basic_meta.t
spamassassin/trunk/t/basic_obj_api.t
spamassassin/trunk/t/bayesbdb.t
spamassassin/trunk/t/bayesdbm.t
spamassassin/trunk/t/bayesdbm_flock.t
spamassassin/trunk/t/bayessdbm.t
spamassassin/trunk/t/bayessdbm_seen_delete.t
spamassassin/trunk/t/bayessql.t
spamassassin/trunk/t/blacklist_autolearn.t
spamassassin/trunk/t/body_mod.t
spamassassin/trunk/t/check_implemented.t
spamassassin/trunk/t/cidrs.t
spamassassin/trunk/t/config_errs.t
spamassassin/trunk/t/config_text.t
spamassassin/trunk/t/config_tree_recurse.t
spamassassin/trunk/t/cpp_comments_in_spamc.t
spamassassin/trunk/t/cross_user_config_leak.t
spamassassin/trunk/t/date.t
spamassassin/trunk/t/db_awl_path.t
spamassassin/trunk/t/db_awl_perms.t
spamassassin/trunk/t/db_based_whitelist.t
spamassassin/trunk/t/db_based_whitelist_ips.t
spamassassin/trunk/t/dcc.t
spamassassin/trunk/t/debug.t
spamassassin/trunk/t/desc_wrap.t
spamassassin/trunk/t/dkim.t
spamassassin/trunk/t/dnsbl.t
spamassassin/trunk/t/dnsbl_sc_meta.t
spamassassin/trunk/t/dnsbl_subtests.t
spamassassin/trunk/t/duplicates.t
spamassassin/trunk/t/get_all_headers.t
spamassassin/trunk/t/get_headers.t
spamassassin/trunk/t/gtube.t
spamassassin/trunk/t/hashcash.t
spamassassin/trunk/t/header_utf8.t
spamassassin/trunk/t/html_colors.t
spamassassin/trunk/t/html_obfu.t
spamassassin/trunk/t/html_utf8.t
spamassassin/trunk/t/idn_dots.t
spamassassin/trunk/t/if_can.t
spamassassin/trunk/t/ifversion.t
spamassassin/trunk/t/ip_addrs.t
spamassassin/trunk/t/lang_lint.t
spamassassin/trunk/t/lang_pl_tests.t
spamassassin/trunk/t/line_endings.t
spamassassin/trunk/t/lint_nocreate_prefs.t
spamassassin/trunk/t/make_install.t
spamassassin/trunk/t/mass_check.t
spamassassin/trunk/t/memory_cycles.t
spamassassin/trunk/t/metadata.t
spamassassin/trunk/t/mimeheader.t
spamassassin/trunk/t/mimeparse.t
spamassassin/trunk/t/missing_hb_separator.t
spamassassin/trunk/t/mkrules.t
spamassassin/trunk/t/mkrules_else.t
spamassassin/trunk/t/nonspam.t
spamassassin/trunk/t/originating_ip_hdr.t
spamassassin/trunk/t/plugin.t
spamassassin/trunk/t/plugin_file.t
spamassassin/trunk/t/plugin_priorities.t
spamassassin/trunk/t/prefs_include.t
spamassassin/trunk/t/priorities.t
spamassassin/trunk/t/razor2.t
spamassassin/trunk/t/rcvd_parser.t
spamassassin/trunk/t/re_base_extraction.t
spamassassin/trunk/t/recips.t
spamassassin/trunk/t/recreate.t
spamassassin/trunk/t/recursion.t
spamassassin/trunk/t/regexp_valid.t
spamassassin/trunk/t/relative_scores.t
spamassassin/trunk/t/report_safe.t
spamassassin/trunk/t/reportheader.t
spamassassin/trunk/t/reportheader_8bit.t
spamassassin/trunk/t/reuse.t
spamassassin/trunk/t/root_spamd.t
spamassassin/trunk/t/root_spamd_tell.t
spamassassin/trunk/t/root_spamd_tell_paranoid.t
spamassassin/trunk/t/root_spamd_tell_x.t
spamassassin/trunk/t/root_spamd_tell_x_paranoid.t
spamassassin/trunk/t/root_spamd_u.t
spamassassin/trunk/t/root_spamd_u_dcc.t
spamassassin/trunk/t/root_spamd_virtual.t
spamassassin/trunk/t/root_spamd_x.t
spamassassin/trunk/t/root_spamd_x_paranoid.t
spamassassin/trunk/t/root_spamd_x_u.t
spamassassin/trunk/t/rule_multiple.t
spamassassin/trunk/t/rule_names.t
spamassassin/trunk/t/rule_tests.t
spamassassin/trunk/t/rule_types.t
spamassassin/trunk/t/sa_awl.t
spamassassin/trunk/t/sa_check_spamd.t
spamassassin/trunk/t/sa_compile.t
spamassassin/trunk/t/sha1.t
spamassassin/trunk/t/shortcircuit.t
spamassassin/trunk/t/spam.t
spamassassin/trunk/t/spamc.t
spamassassin/trunk/t/spamc_B.t
spamassassin/trunk/t/spamc_E.t
spamassassin/trunk/t/spamc_H.t
spamassassin/trunk/t/spamc_bug6176.t
spamassassin/trunk/t/spamc_c.t
spamassassin/trunk/t/spamc_c_stdout_closed.t
spamassassin/trunk/t/spamc_cf.t
spamassassin/trunk/t/spamc_headers.t
spamassassin/trunk/t/spamc_l.t
spamassassin/trunk/t/spamc_optC.t
spamassassin/trunk/t/spamc_optL.t
spamassassin/trunk/t/spamc_x_E_R.t
spamassassin/trunk/t/spamc_x_e.t
spamassassin/trunk/t/spamc_y.t
spamassassin/trunk/t/spamc_z.t
spamassassin/trunk/t/spamd.t
spamassassin/trunk/t/spamd_allow_user_rules.t
spamassassin/trunk/t/spamd_client.t
spamassassin/trunk/t/spamd_hup.t
spamassassin/trunk/t/spamd_kill_restart.t
spamassassin/trunk/t/spamd_kill_restart_rr.t
spamassassin/trunk/t/spamd_ldap.t
spamassassin/trunk/t/spamd_maxchildren.t
spamassassin/trunk/t/spamd_maxsize.t
spamassassin/trunk/t/spamd_parallel.t
spamassassin/trunk/t/spamd_plugin.t
spamassassin/trunk/t/spamd_port.t
spamassassin/trunk/t/spamd_prefork_stress.t
spamassassin/trunk/t/spamd_prefork_stress_2.t
spamassassin/trunk/t/spamd_prefork_stress_3.t
spamassassin/trunk/t/spamd_prefork_stress_4.t
spamassassin/trunk/t/spamd_protocol_10.t
spamassassin/trunk/t/spamd_report.t
spamassassin/trunk/t/spamd_report_ifspam.t
spamassassin/trunk/t/spamd_sql_prefs.t
spamassassin/trunk/t/spamd_ssl.t
spamassassin/trunk/t/spamd_ssl_accept_fail.t
spamassassin/trunk/t/spamd_stop.t
spamassassin/trunk/t/spamd_symbols.t
spamassassin/trunk/t/spamd_syslog.t
spamassassin/trunk/t/spamd_unix.t
spamassassin/trunk/t/spamd_unix_and_tcp.t
spamassassin/trunk/t/spamd_user_rules_leak.t
spamassassin/trunk/t/spamd_utf8.t
spamassassin/trunk/t/spamd_whitelist_leak.t
spamassassin/trunk/t/spf.t
spamassassin/trunk/t/sql_based_whitelist.t
spamassassin/trunk/t/stop_always_matching_regexps.t
spamassassin/trunk/t/strip2.t
spamassassin/trunk/t/strip_no_subject.t
spamassassin/trunk/t/stripmarkup.t
spamassassin/trunk/t/tainted_msg.t
spamassassin/trunk/t/text_bad_ctype.t
spamassassin/trunk/t/timeout.t
spamassassin/trunk/t/trust_path.t
spamassassin/trunk/t/uri.t
spamassassin/trunk/t/uri_html.t
spamassassin/trunk/t/uri_text.t
spamassassin/trunk/t/uribl.t
spamassassin/trunk/t/uribl_all_types.t
spamassassin/trunk/t/uribl_domains_only.t
spamassassin/trunk/t/uribl_ips_only.t
spamassassin/trunk/t/utf8.t
spamassassin/trunk/t/util_wrap.t
spamassassin/trunk/t/whitelist_addrs.t
spamassassin/trunk/t/whitelist_from.t
spamassassin/trunk/t/whitelist_subject.t
spamassassin/trunk/t/whitelist_to.t
spamassassin/trunk/t/zz_cleanup.t
Modified: spamassassin/trunk/Makefile.PL
URL: http://svn.apache.org/viewvc/spamassassin/trunk/Makefile.PL?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/Makefile.PL (original)
+++ spamassassin/trunk/Makefile.PL Mon Feb 5 09:10:59 2018
@@ -189,6 +189,7 @@ my %makefile = (
'Net::DNS' => (RUNNING_ON_WINDOWS ? 0.46 : 0.34), # bugs in older revs
'NetAddr::IP' => 4.010,
'Sys::Hostname' => 0,
+ 'Test::More' => 0,
'Time::HiRes' => 0,
'Time::Local' => 0,
'Errno' => 0,
Modified: spamassassin/trunk/t/SATest.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/SATest.pm?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/SATest.pm (original)
+++ spamassassin/trunk/t/SATest.pm Mon Feb 5 09:10:59 2018
@@ -12,6 +12,10 @@ use File::Basename;
use File::Copy;
use File::Path;
use File::Spec;
+
+use Test::Builder ();
+use Test::More ();
+
use POSIX qw(WIFEXITED WIFSIGNALED WIFSTOPPED WEXITSTATUS WTERMSIG WSTOPSIG);
use vars qw($RUNNING_ON_WINDOWS $SSL_AVAILABLE
@@ -338,10 +342,13 @@ sub sarun {
$scrargs =~ s!/!\\!g if ($^O =~ /^MS(DOS|Win)/i);
print ("\t$scrargs\n");
(-d "log/d.$testname") or mkdir ("log/d.$testname", 0755);
- system ("$scrargs > log/d.$testname/${Test::ntest} $post_redir");
+
+ my $test_number = test_number();
+
+ system ("$scrargs > log/d.$testname/$test_number $post_redir");
$sa_exitcode = ($?>>8);
if ($sa_exitcode != 0) { return undef; }
- &checkfile ("d.$testname/${Test::ntest}", $read_sub) if (defined $read_sub);
+ &checkfile ("d.$testname/$test_number", $read_sub) if (defined $read_sub);
1;
}
@@ -372,10 +379,13 @@ sub salearnrun {
$salearnargs =~ s!/!\\!g if ($^O =~ /^MS(DOS|Win)/i);
print ("\t$salearnargs\n");
(-d "log/d.$testname") or mkdir ("log/d.$testname", 0755);
- system ("$salearnargs > log/d.$testname/${Test::ntest}");
+
+ my $test_number = test_number();
+
+ system ("$salearnargs > log/d.$testname/$test_number");
$salearn_exitcode = ($?>>8);
if ($salearn_exitcode != 0) { return undef; }
- &checkfile ("d.$testname/${Test::ntest}", $read_sub) if (defined $read_sub);
+ &checkfile ("d.$testname/$test_number", $read_sub) if (defined $read_sub);
1;
}
@@ -416,10 +426,13 @@ sub spamcrun {
print ("\t$spamcargs\n");
(-d "log/d.$testname") or mkdir ("log/d.$testname", 0755);
+
+ my $test_number = test_number();
+
if ($capture_stderr) {
- system ("$spamcargs > log/d.$testname/out.${Test::ntest} 2>&1");
+ system ("$spamcargs > log/d.$testname/out.$test_number 2>&1");
} else {
- system ("$spamcargs > log/d.$testname/out.${Test::ntest}");
+ system ("$spamcargs > log/d.$testname/out.$test_number");
}
$sa_exitcode = ($?>>8);
@@ -429,7 +442,7 @@ sub spamcrun {
%found = ();
%found_anti = ();
- &checkfile ("d.$testname/out.${Test::ntest}", $read_sub) if (defined $read_sub);
+ &checkfile ("d.$testname/out.$test_number", $read_sub) if (defined $read_sub);
if ($expect_failure) {
($sa_exitcode != 0);
@@ -459,7 +472,9 @@ sub spamcrun_background {
print ("\t$spamcargs &\n");
(-d "log/d.$testname") or mkdir ("log/d.$testname", 0755);
- system ("$spamcargs > log/d.$testname/bg.${Test::ntest} &") and return 0;
+
+ my $test_number = test_number();
+ system ("$spamcargs > log/d.$testname/bg.$test_number &") and return 0;
1;
}
@@ -531,9 +546,11 @@ sub start_spamd {
}
(-d "log/d.$testname") or mkdir ("log/d.$testname", 0755);
- my $spamd_stdout = "log/d.$testname/spamd.out.${Test::ntest}";
- $spamd_stderr = "log/d.$testname/spamd.err.${Test::ntest}"; # global
- my $spamd_stdlog = "log/d.$testname/spamd.log.${Test::ntest}";
+
+ my $test_number = test_number();
+ my $spamd_stdout = "log/d.$testname/spamd.out.$test_number";
+ $spamd_stderr = "log/d.$testname/spamd.err.$test_number"; # global
+ my $spamd_stdlog = "log/d.$testname/spamd.log.$test_number";
my $spamd_forker = $ENV{'SPAMD_FORKER'} ?
$ENV{'SPAMD_FORKER'} :
@@ -555,7 +572,7 @@ sub start_spamd {
# DEBUG instrumentation to trace spamd processes. See bug 5731 for history
# if (-f "/home/jm/capture_spamd_straces") {
- # $spamd_cmd = "strace -ttt -fo log/d.$testname/spamd.strace.${Test::ntest} $spamd_cmd";
+ # $spamd_cmd = "strace -ttt -fo log/d.$testname/spamd.strace.$test_number $spamd_cmd";
# }
unlink ($spamd_stdout, $spamd_stderr, $spamd_stdlog);
@@ -1072,4 +1089,8 @@ sub debug_array {
return $string;
}
+sub test_number {
+ return Test::More->builder->current_test;
+}
+
1;
Modified: spamassassin/trunk/t/autolearn.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/autolearn.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/autolearn.t (original)
+++ spamassassin/trunk/t/autolearn.t Mon Feb 5 09:10:59 2018
@@ -2,16 +2,13 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("autolearn");
-use Test;
-use constant TEST_ENABLED => eval { require DB_File; };
+use constant HAS_DB_FILE => eval { require DB_File; };
-BEGIN {
- plan tests => (TEST_ENABLED ? 2 : 0);
-};
-
-exit unless TEST_ENABLED;
+use Test::More;
+plan skip_all => 'Need DB_File for this test' unless HAS_DB_FILE;
+plan tests => 2;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/autolearn_force.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/autolearn_force.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/autolearn_force.t (original)
+++ spamassassin/trunk/t/autolearn_force.t Mon Feb 5 09:10:59 2018
@@ -2,16 +2,13 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("autolearn_force");
-use Test;
-use constant TEST_ENABLED => eval { require DB_File; };
+use constant HAS_DB_FILE => eval { require DB_File; };
-BEGIN {
- plan tests => (TEST_ENABLED ? 2 : 0);
-};
-
-exit unless TEST_ENABLED;
+use Test::More;
+plan skip_all => 'Need DB_File for this test' unless HAS_DB_FILE;
+plan tests => 2;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/autolearn_force_fail.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/autolearn_force_fail.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/autolearn_force_fail.t (original)
+++ spamassassin/trunk/t/autolearn_force_fail.t Mon Feb 5 09:10:59 2018
@@ -2,17 +2,13 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("autolearn_force_fail");
-use Test;
-use Test;
+use constant HAS_DB_FILE => eval { require DB_File; };
-use constant TEST_ENABLED => eval { require DB_File; };
+use Test::More;
-BEGIN {
- plan tests => (TEST_ENABLED ? 3 : 0);
-};
-
-exit unless TEST_ENABLED;
+plan skip_all => 'Need DB_File for this test' unless HAS_DB_FILE;
+plan tests => 3;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/basic_lint.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/basic_lint.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/basic_lint.t (original)
+++ spamassassin/trunk/t/basic_lint.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("basic_lint");
-use Test; BEGIN { plan tests => 1 };
+use Test::More tests => 1;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/basic_lint_without_sandbox.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/basic_lint_without_sandbox.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/basic_lint_without_sandbox.t (original)
+++ spamassassin/trunk/t/basic_lint_without_sandbox.t Mon Feb 5 09:10:59 2018
@@ -4,7 +4,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("basic_lint_without_sandbox");
-use Test; BEGIN { plan tests => 3 };
+use Test::More tests => 3;
# ---------------------------------------------------------------------------
@@ -23,9 +23,12 @@ my $sandboxfile = "log/test_rules_copy/7
# when running from the built tarball or make disttest, we will not have a full
# rules dir -- therefore no 70_sandbox.cf. We will also have no 50_scores.cf,
# so we can use that to tell if this is the case
-skip (!-f $scoresfile, -f $sandboxfile);
-unlink $sandboxfile;
-skip (!-f $scoresfile, !-f $sandboxfile);
+SKIP: {
+ skip( "Not on a sandbox", 2 ) unless -f $scoresfile;
+ ok -f $sandboxfile;
+ unlink $sandboxfile;
+ ok !-f $sandboxfile;
+}
sarun ("-L --lint", \&patterns_run_cb);
ok_all_patterns();
Modified: spamassassin/trunk/t/basic_meta.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/basic_meta.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/basic_meta.t (original)
+++ spamassassin/trunk/t/basic_meta.t Mon Feb 5 09:10:59 2018
@@ -18,18 +18,19 @@ if (-e 'test_dir') { # runnin
use strict;
use lib '.'; use lib 't';
use SATest; sa_t_init("meta");
-use Test;
+
use Mail::SpamAssassin;
use vars qw( %rules %scores $perl_path);
# "parse-rules-for-masses" requires Data::Dumper
use constant HAS_DATADUMPER => eval 'use Data::Dumper; 1;';
-use constant IS_WINDOWS => ($^O =~ /^(mswin|dos|os2)/oi);
-use constant DO_RUN => HAS_DATADUMPER && !IS_WINDOWS;
-plan tests => (DO_RUN ? 2 : 0);
-exit unless DO_RUN;
+use Test::More;
+
+plan skip_all => "Needs Data::Dumper" unless HAS_DATADUMPER;
+plan skip_all => "Tests don't work on Windows" if $^O =~ /^(mswin|dos|os2)/i;
+plan tests => 2;
# meta failures
my $meta_dependency_disabled = 0;
Modified: spamassassin/trunk/t/basic_obj_api.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/basic_obj_api.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/basic_obj_api.t (original)
+++ spamassassin/trunk/t/basic_obj_api.t Mon Feb 5 09:10:59 2018
@@ -18,7 +18,7 @@ if (-e 'test_dir') { # runnin
use lib '.'; use lib 't';
use SATest; sa_t_init("basic_obj_api");
-use Test; BEGIN { plan tests => 4 };
+use Test::More tests => 4;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/bayesbdb.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayesbdb.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/bayesbdb.t (original)
+++ spamassassin/trunk/t/bayesbdb.t Mon Feb 5 09:10:59 2018
@@ -3,12 +3,10 @@
use Data::Dumper;
use lib '.'; use lib 't';
use SATest; sa_t_init("bayes");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_long_tests') && eval {
- require BerkeleyDB; no warnings qw(once); $BerkeleyDB::db_version >= 4.6;
-};
+use constant HAS_BDB => eval { require BerkeleyDB };
+use Test::More;
BEGIN {
if (-e 't/test_dir') {
chdir 't';
@@ -17,11 +15,18 @@ BEGIN {
if (-e 'test_dir') {
unshift(@INC, '../blib/lib');
}
+}
- plan tests => (TEST_ENABLED ? 42 : 0);
-};
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan skip_all => "BerkeleyDB is unavailable" unless HAS_BDB;
+
+{
+ no warnings 'once';
+ plan skip_all => "BerkeleyDB >= 4.6 is required" unless $BerkeleyDB::db_version >= 4.6;
+}
+
+plan tests => 42;
-exit unless TEST_ENABLED;
tstlocalrules ("
bayes_store_module Mail::SpamAssassin::BayesStore::BDB
Modified: spamassassin/trunk/t/bayesdbm.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayesdbm.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/bayesdbm.t (original)
+++ spamassassin/trunk/t/bayesdbm.t Mon Feb 5 09:10:59 2018
@@ -3,11 +3,10 @@
use Data::Dumper;
use lib '.'; use lib 't';
use SATest; sa_t_init("bayes");
-use Test;
-
-use constant TEST_ENABLED => conf_bool('run_long_tests') &&
- eval { require DB_File; };
+use constant HAS_DB_FILE => eval { require DB_File };
+
+use Test::More;
BEGIN {
if (-e 't/test_dir') {
chdir 't';
@@ -16,11 +15,11 @@ BEGIN {
if (-e 'test_dir') {
unshift(@INC, '../blib/lib');
}
+}
- plan tests => (TEST_ENABLED ? 48 : 0);
-};
-
-exit unless TEST_ENABLED;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan skip_all => "DB_File is unavailable" unless HAS_DB_FILE;
+plan tests => 48;
tstlocalrules ("
bayes_learn_to_journal 0
Modified: spamassassin/trunk/t/bayesdbm_flock.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayesdbm_flock.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/bayesdbm_flock.t (original)
+++ spamassassin/trunk/t/bayesdbm_flock.t Mon Feb 5 09:10:59 2018
@@ -3,11 +3,10 @@
use Data::Dumper;
use lib '.'; use lib 't';
use SATest; sa_t_init("bayesdbm_flock");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_long_tests') &&
- eval { require DB_File; };
+use constant HAS_DB_FILE => eval { require DB_File };
+use Test::More;
BEGIN {
if (-e 't/test_dir') {
chdir 't';
@@ -16,11 +15,12 @@ BEGIN {
if (-e 'test_dir') {
unshift(@INC, '../blib/lib');
}
+}
- plan tests => ((TEST_ENABLED && !$RUNNING_ON_WINDOWS) ? 48 : 0);
-};
-
-exit unless (TEST_ENABLED && !$RUNNING_ON_WINDOWS);
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan skip_all => "Tests don't work on windows" if $RUNNING_ON_WINDOWS;
+plan skip_all => "DB_File is unavailable" unless HAS_DB_FILE;
+plan tests => 48;
tstlocalrules ("
bayes_learn_to_journal 0
Modified: spamassassin/trunk/t/bayessdbm.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayessdbm.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/bayessdbm.t (original)
+++ spamassassin/trunk/t/bayessdbm.t Mon Feb 5 09:10:59 2018
@@ -3,12 +3,11 @@
use Data::Dumper;
use lib '.'; use lib 't';
use SATest; sa_t_init("bayes");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_long_tests') &&
- eval { require SDBM_File; };
+use constant HAS_SDBM_FILE => eval { require SDBM_File };
-BEGIN {
+use Test::More;
+BEGIN {
if (-e 't/test_dir') {
chdir 't';
}
@@ -16,11 +15,11 @@ BEGIN {
if (-e 'test_dir') {
unshift(@INC, '../blib/lib');
}
+}
- plan tests => (TEST_ENABLED ? 52 : 0);
-};
-
-exit unless TEST_ENABLED;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan skip_all => "No SDBM_File" unless HAS_SDBM_FILE;
+plan tests => 52;
tstlocalrules ("
bayes_store_module Mail::SpamAssassin::BayesStore::SDBM
Modified: spamassassin/trunk/t/bayessdbm_seen_delete.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayessdbm_seen_delete.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/bayessdbm_seen_delete.t (original)
+++ spamassassin/trunk/t/bayessdbm_seen_delete.t Mon Feb 5 09:10:59 2018
@@ -3,12 +3,15 @@
use Data::Dumper;
use lib '.'; use lib 't';
use SATest; sa_t_init("bayessdbm_seen_delete");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_long_tests') &&
- eval { require SDBM_File; };
+use constant HAS_SDBM_FILE => eval { require SDBM_File };
-BEGIN {
+use Test::More;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan skip_all => "No SDBM_File" unless HAS_SDBM_FILE;
+plan tests => 54;
+
+BEGIN {
if (-e 't/test_dir') {
chdir 't';
}
@@ -16,11 +19,7 @@ BEGIN {
if (-e 'test_dir') {
unshift(@INC, '../blib/lib');
}
-
- plan tests => (TEST_ENABLED ? 54 : 0);
-};
-
-exit unless TEST_ENABLED;
+}
tstlocalrules ("
bayes_store_module Mail::SpamAssassin::BayesStore::SDBM
Modified: spamassassin/trunk/t/bayessql.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/bayessql.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/bayessql.t (original)
+++ spamassassin/trunk/t/bayessql.t Mon Feb 5 09:10:59 2018
@@ -2,12 +2,15 @@
use lib '.'; use lib 't';
use SATest;
-use Test;
-use constant TEST_ENABLED => conf_bool('run_bayes_sql_tests');
use constant HAS_DBI => eval { require DBI; }; # for our cleanup stuff
-BEGIN {
+use Test::More;
+plan skip_all => "Bayes SQL tests are disabled" unless conf_bool('run_bayes_sql_tests');
+plan skip_all => "DBI is unavailable on this system" unless HAS_DBI;
+plan tests => 53;
+
+BEGIN {
if (-e 't/test_dir') {
chdir 't';
}
@@ -15,15 +18,9 @@ BEGIN {
if (-e 'test_dir') {
unshift(@INC, '../blib/lib');
}
+}
- plan tests => ((TEST_ENABLED && HAS_DBI) ? 53 : 0);
-
- onfail => sub {
- warn "\n\nNote: Failure may be due to an incorrect config.";
- }
-};
-
-exit unless TEST_ENABLED;
+diag "Note: Failure may be due to an incorrect config.";
my $dbdsn = conf('bayes_sql_dsn');
my $dbusername = conf('bayes_sql_username');
Modified: spamassassin/trunk/t/blacklist_autolearn.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/blacklist_autolearn.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/blacklist_autolearn.t (original)
+++ spamassassin/trunk/t/blacklist_autolearn.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("blacklist_autolearn");
-use Test; BEGIN { plan tests => 3 };
+use Test::More tests => 3;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/body_mod.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/body_mod.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/body_mod.t (original)
+++ spamassassin/trunk/t/body_mod.t Mon Feb 5 09:10:59 2018
@@ -18,7 +18,7 @@ if (-e 'test_dir') { # runnin
use strict;
use lib '.'; use lib 't';
use SATest; sa_t_init("body_mod");
-use Test; BEGIN { plan tests => 3 };
+use Test::More tests => 3;
use Mail::SpamAssassin;
Modified: spamassassin/trunk/t/check_implemented.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/check_implemented.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/check_implemented.t (original)
+++ spamassassin/trunk/t/check_implemented.t Mon Feb 5 09:10:59 2018
@@ -21,12 +21,10 @@ if (-e 'test_dir') { # runnin
use lib '.'; use lib 't';
use SATest; sa_t_init("check_implemented");
-use Test;
+
use Carp qw(croak);
-BEGIN {
- plan tests => 2;
-};
+use Test::More tests => 2;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/cidrs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/cidrs.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/cidrs.t (original)
+++ spamassassin/trunk/t/cidrs.t Mon Feb 5 09:10:59 2018
@@ -16,9 +16,8 @@ if (-e 'test_dir') { # runnin
}
use strict;
-use Test;
-plan tests => 51;
+use Test::More tests => 51;
use Mail::SpamAssassin;
use Mail::SpamAssassin::NetSet;
Modified: spamassassin/trunk/t/config_errs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/config_errs.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/config_errs.t (original)
+++ spamassassin/trunk/t/config_errs.t Mon Feb 5 09:10:59 2018
@@ -1,13 +1,10 @@
#!/usr/bin/perl -w
-# TODO: this script does not work yet. There are (a) lots of failures
-# and (b) the 'plan' line means all tests are effectively ignored from
-# 'make test'.
+use Test::More;
-use Test;
-
-plan tests => 0;
-exit 0;
+# TODO: Now we're using Test::More, we could choose to make the failing tests TODO tests so we know if they start passing.
+plan skip_all => q{This script does not work yet. There are (a) lots of failures and (b) the 'plan' line means all tests are effectively ignored from 'make test'.};
+exit 0;
# ---------------------------------------------------------------------------
@@ -43,7 +40,6 @@ if (-e 'test_dir') { # runnin
use strict;
use lib '.'; use lib 't';
use SATest; sa_t_init("config_errs");
-use Test;
use Mail::SpamAssassin;
# initialize SpamAssassin
Modified: spamassassin/trunk/t/config_text.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/config_text.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/config_text.t (original)
+++ spamassassin/trunk/t/config_text.t Mon Feb 5 09:10:59 2018
@@ -1,14 +1,14 @@
#!/usr/bin/perl
-use constant IS_WINDOWS => ($^O =~ /^(mswin|dos|os2)/oi);
-
use lib '.'; use lib 't';
use SATest; sa_t_init("config_text");
# skip the test on Windows; the switches contain spaces, which does not
# work too well with win32 CMD.EXE
-use Test; BEGIN { plan tests => IS_WINDOWS ? 0 : 2 };
-exit if IS_WINDOWS;
+
+use Test::More;
+plan skip_all => "These tests don't work on windows" if $^O =~ /^(mswin|dos|os2)/i;
+plan tests => 2;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/config_tree_recurse.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/config_tree_recurse.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/config_tree_recurse.t (original)
+++ spamassassin/trunk/t/config_tree_recurse.t Mon Feb 5 09:10:59 2018
@@ -23,7 +23,7 @@ if (-e 'test_dir') { # runnin
use lib '.'; use lib 't';
use SATest; sa_t_init("basic_obj_api");
-use Test; BEGIN { plan tests => 4 };
+use Test::More tests => 4;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/cpp_comments_in_spamc.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/cpp_comments_in_spamc.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/cpp_comments_in_spamc.t (original)
+++ spamassassin/trunk/t/cpp_comments_in_spamc.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("cpp_comments_in_spamc");
-use Test; BEGIN { plan tests => 1 };
+use Test::More tests => 1;
# ---------------------------------------------------------------------------
# by simply reading the files directly in perl, we avoid all sorts
Modified: spamassassin/trunk/t/cross_user_config_leak.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/cross_user_config_leak.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/cross_user_config_leak.t (original)
+++ spamassassin/trunk/t/cross_user_config_leak.t Mon Feb 5 09:10:59 2018
@@ -18,7 +18,7 @@ if (-e 'test_dir') { # runnin
use lib '.'; use lib 't';
use SATest; sa_t_init("cross_user_config_leak");
-use Test; BEGIN { plan tests => 6 };
+use Test::More tests => 6;
# ---------------------------------------------------------------------------
# bug 6003
Modified: spamassassin/trunk/t/date.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/date.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/date.t (original)
+++ spamassassin/trunk/t/date.t Mon Feb 5 09:10:59 2018
@@ -16,11 +16,11 @@ if (-e 'test_dir') { # runnin
}
use strict;
-use Test;
+
use Mail::SpamAssassin;
use Mail::SpamAssassin::Util;
-plan tests => 14;
+use Test::More tests => 14;
sub try {
my ($data, $want) = @_;
Modified: spamassassin/trunk/t/db_awl_path.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/db_awl_path.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/db_awl_path.t (original)
+++ spamassassin/trunk/t/db_awl_path.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("db_awl_path");
-use Test; BEGIN { plan tests => 4 };
+use Test::More tests => 4;
use IO::File;
# ---------------------------------------------------------------------------
@@ -36,8 +36,8 @@ my $error = do {
<$fh>;
};
-print "# $error\n";
-ok($error, qr/(cannot create tmp lockfile)|(unlink of lock file.*failed)/, "Check we get the right error back");
+diag $error;
+like($error, qr/(cannot create tmp lockfile)|(unlink of lock file.*failed)/, "Check we get the right error back");
# and this mail should *not* be whitelisted as a result.
%patterns = %is_spam_patterns;
Modified: spamassassin/trunk/t/db_awl_perms.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/db_awl_perms.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/db_awl_perms.t (original)
+++ spamassassin/trunk/t/db_awl_perms.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("db_awl_perms");
-use Test; BEGIN { plan tests => 5 };
+use Test::More tests => 5;
use IO::File;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/db_based_whitelist.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/db_based_whitelist.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/db_based_whitelist.t (original)
+++ spamassassin/trunk/t/db_based_whitelist.t Mon Feb 5 09:10:59 2018
@@ -3,13 +3,10 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("db_based_whitelist");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_long_tests');
-BEGIN {
- plan tests => (TEST_ENABLED ? 8 : 0);
-};
-exit unless TEST_ENABLED;
+use Test::More;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan tests => 8;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/db_based_whitelist_ips.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/db_based_whitelist_ips.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/db_based_whitelist_ips.t (original)
+++ spamassassin/trunk/t/db_based_whitelist_ips.t Mon Feb 5 09:10:59 2018
@@ -3,13 +3,10 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("db_based_whitelist_ips");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_long_tests');
-BEGIN {
- plan tests => (TEST_ENABLED ? 8 : 0);
-};
-exit unless TEST_ENABLED;
+use Test::More;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan tests => 8;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/dcc.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/dcc.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/dcc.t (original)
+++ spamassassin/trunk/t/dcc.t Mon Feb 5 09:10:59 2018
@@ -3,19 +3,12 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("dcc");
-use constant TEST_ENABLED => conf_bool('run_dcc_tests');
+use Test::More;
+plan skip_all => "DCC tests disabled" unless conf_bool('run_dcc_tests');
+plan tests => 4;
-use Test;
+diag('Note: Failure may not be an SpamAssassin bug, as DCC tests can fail due to problems with the DCC servers.');
-BEGIN {
- plan tests => (TEST_ENABLED ? 4 : 0),
- onfail => sub {
- warn "\n\nNote: this may not be an SpamAssassin bug, as DCC tests can" .
- "\nfail due to problems with the DCC servers.\n\n";
- }
-};
-
-exit unless TEST_ENABLED;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/debug.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/debug.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/debug.t (original)
+++ spamassassin/trunk/t/debug.t Mon Feb 5 09:10:59 2018
@@ -18,15 +18,12 @@ if (-e 'test_dir') { # runnin
use strict;
use lib '.'; use lib 't';
use SATest; sa_t_init("debug");
-use Test;
-use Mail::SpamAssassin;
-use constant TEST_ENABLED => conf_bool('run_long_tests');
+use Mail::SpamAssassin;
-BEGIN {
- plan tests => (TEST_ENABLED ? 3 : 0);
-};
-exit unless TEST_ENABLED;
+use Test::More;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan tests => 3;
# list of known debug facilities
my %facility = map( ($_, 1),
Modified: spamassassin/trunk/t/desc_wrap.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/desc_wrap.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/desc_wrap.t (original)
+++ spamassassin/trunk/t/desc_wrap.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("desc_wrap");
-use Test; BEGIN { plan tests => 10 };
+use Test::More tests => 10;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/dkim.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/dkim.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/dkim.t (original)
+++ spamassassin/trunk/t/dkim.t Mon Feb 5 09:10:59 2018
@@ -6,19 +6,18 @@ use re 'taint';
use lib '.'; use lib 't';
use SATest; sa_t_init("dkim");
-use Test;
use vars qw(%patterns %anti_patterns);
-use constant num_tests => 199;
-
-use constant TEST_ENABLED => conf_bool('run_net_tests');
-use constant HAS_MODULES => eval {
+use constant HAS_DKIM_VERIFIER => eval {
require Mail::DKIM::Verifier;
Mail::DKIM::Verifier->VERSION >= 0.31;
};
-use constant DO_RUN => TEST_ENABLED && HAS_MODULES;
+use Test::More;
+plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
+plan skip_all => "Needs Mail::DKIM::Verifier >= 0.31" unless HAS_DKIM_VERIFIER ;
+plan tests => 199;
BEGIN {
if (-e 't/test_dir') {
@@ -28,11 +27,7 @@ BEGIN {
if (-e 'test_dir') {
unshift(@INC, '../blib/lib');
}
-
- plan tests => (DO_RUN ? num_tests : 0);
-};
-
-exit unless (DO_RUN);
+}
my $prefix = '.';
if (-e 'test_dir') { # running from test directory, not ..
Modified: spamassassin/trunk/t/dnsbl.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/dnsbl.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/dnsbl.t (original)
+++ spamassassin/trunk/t/dnsbl.t Mon Feb 5 09:10:59 2018
@@ -3,15 +3,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("dns");
-use constant TEST_ENABLED => conf_bool('run_net_tests') && conf_bool('run_long_tests');
-use constant DO_RUN => TEST_ENABLED && can_use_net_dns_safely();
-use Test;
-
-BEGIN {
- plan tests => (DO_RUN ? 23 : 0),
-};
-
-exit unless (DO_RUN);
+use Test::More;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
+plan skip_all => "Can't use Net::DNS Safely" unless can_use_net_dns_safely();
+plan tests => 23;
# ---------------------------------------------------------------------------
# bind configuration currently used to support this test
Modified: spamassassin/trunk/t/dnsbl_sc_meta.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/dnsbl_sc_meta.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/dnsbl_sc_meta.t (original)
+++ spamassassin/trunk/t/dnsbl_sc_meta.t Mon Feb 5 09:10:59 2018
@@ -3,15 +3,10 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("dnsbl_sc_meta");
-use constant TEST_ENABLED => conf_bool('run_net_tests');
-use constant DO_RUN => TEST_ENABLED && can_use_net_dns_safely();
-use Test;
-
-BEGIN {
- plan tests => (DO_RUN ? 2 : 0),
-};
-
-exit unless (DO_RUN);
+use Test::More;
+plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
+plan skip_all => "Can't use Net::DNS Safely" unless can_use_net_dns_safely();
+plan tests => 2;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/dnsbl_subtests.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/dnsbl_subtests.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/dnsbl_subtests.t (original)
+++ spamassassin/trunk/t/dnsbl_subtests.t Mon Feb 5 09:10:59 2018
@@ -8,17 +8,9 @@ use re 'taint';
use lib '.'; use lib 't';
use SATest; sa_t_init("dnsbl_subtests");
-use Test;
use vars qw(%patterns %anti_patterns);
-use constant num_tests => 46;
-use constant DO_RUN => 1;
-
-BEGIN {
- plan tests => (DO_RUN ? num_tests : 0);
-};
-
-exit unless DO_RUN;
+use Test::More tests => 46;
my $prefix = '.';
if (-e 'test_dir') { # running from test directory, not ..
Modified: spamassassin/trunk/t/duplicates.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/duplicates.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/duplicates.t (original)
+++ spamassassin/trunk/t/duplicates.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("duplicates");
-use Test; BEGIN { plan tests => 21 };
+use Test::More tests => 21;
$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we need the patterns to work
Modified: spamassassin/trunk/t/get_all_headers.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/get_all_headers.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/get_all_headers.t (original)
+++ spamassassin/trunk/t/get_all_headers.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("get_all_headers");
-use Test; BEGIN { plan tests => 5 };
+use Test::More tests => 5;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/get_headers.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/get_headers.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/get_headers.t (original)
+++ spamassassin/trunk/t/get_headers.t Mon Feb 5 09:10:59 2018
@@ -16,12 +16,12 @@ if (-e 'test_dir') { # runnin
}
use strict;
-use Test;
+
use lib '.'; use lib 't';
use SATest; sa_t_init("get_headers");
use Mail::SpamAssassin;
-plan tests => 16;
+use Test::More tests => 16;
##############################################
Modified: spamassassin/trunk/t/gtube.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/gtube.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/gtube.t (original)
+++ spamassassin/trunk/t/gtube.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("spam");
-use Test; BEGIN { plan tests => 4 };
+use Test::More tests => 4;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/hashcash.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/hashcash.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/hashcash.t (original)
+++ spamassassin/trunk/t/hashcash.t Mon Feb 5 09:10:59 2018
@@ -4,11 +4,11 @@ use lib '.'; use lib 't';
use SATest; sa_t_init("hashcash");
# we need DB_File to support the double-spend db.
-use constant HAS_DB_FILE => eval { require DB_File; };
+use constant HAS_DB_FILE => eval { require DB_File };
-use Test; BEGIN { plan tests => HAS_DB_FILE ? 4 : 0 };
-
-exit unless HAS_DB_FILE;
+use Test::More;
+plan skip_all => "This test requires DB_File" unless HAS_DB_FILE;
+plan tests => 4;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/header_utf8.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/header_utf8.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/header_utf8.t (original)
+++ spamassassin/trunk/t/header_utf8.t Mon Feb 5 09:10:59 2018
@@ -3,16 +3,14 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("header_utf8.t");
-use constant TEST_ENABLED => ($] >= 5.008);
-
-our $have_libidn;
+my $have_libidn;
BEGIN {
eval { require Net::LibIDN } and do { $have_libidn = 1 };
}
-use Test; BEGIN { plan tests => (TEST_ENABLED ? 156 : 0) };
-
-exit unless (TEST_ENABLED);
+use Test::More;
+plan skip_all => "Test requires Perl 5.8" unless $] > 5.008; # TODO: SA already doesn't support anything below 5.8.1
+plan tests => 156;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/html_colors.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/html_colors.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/html_colors.t (original)
+++ spamassassin/trunk/t/html_colors.t Mon Feb 5 09:10:59 2018
@@ -16,12 +16,10 @@ if (-e 'test_dir') { # runnin
}
use strict;
-use Test;
+use Test::More tests => 28;
use Mail::SpamAssassin;
use Mail::SpamAssassin::HTML;
-plan tests => 28;
-
sub try {
my ($data, $want) = @_;
Modified: spamassassin/trunk/t/html_obfu.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/html_obfu.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/html_obfu.t (original)
+++ spamassassin/trunk/t/html_obfu.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("html_obfu");
-use Test; BEGIN { plan tests => 9 };
+use Test::More tests => 9;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/html_utf8.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/html_utf8.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/html_utf8.t (original)
+++ spamassassin/trunk/t/html_utf8.t Mon Feb 5 09:10:59 2018
@@ -3,11 +3,9 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("html_obfu");
-use constant TEST_ENABLED => ($] > 5.008004);
-
-use Test; BEGIN { plan tests => (TEST_ENABLED ? 2 : 0) };
-
-exit unless (TEST_ENABLED);
+use Test::More;
+plan skip_all => "Test requires Perl 5.8.5" unless $] > 5.008004;
+plan tests => 2;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/idn_dots.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/idn_dots.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/idn_dots.t (original)
+++ spamassassin/trunk/t/idn_dots.t Mon Feb 5 09:10:59 2018
@@ -20,13 +20,10 @@ if (-e 'test_dir') { # runnin
use strict;
use lib '.'; use lib 't';
use SATest; sa_t_init("normalize_utf8_dots.t");
-use Test;
+use Test::More tests => 6;
use Mail::SpamAssassin;
use vars qw(%patterns %anti_patterns);
-# settings
-plan tests => 6;
-
# initialize SpamAssassin
my $sa = create_saobj({dont_copy_prefs => 1});
$sa->init(0); # parse rules
Modified: spamassassin/trunk/t/if_can.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/if_can.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/if_can.t (original)
+++ spamassassin/trunk/t/if_can.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("if_can");
-use Test; BEGIN { plan tests => 13 };
+use Test::More tests => 13;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/ifversion.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/ifversion.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/ifversion.t (original)
+++ spamassassin/trunk/t/ifversion.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("ifversion");
-use Test; BEGIN { plan tests => 4 };
+use Test::More tests => 4;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/ip_addrs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/ip_addrs.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/ip_addrs.t (original)
+++ spamassassin/trunk/t/ip_addrs.t Mon Feb 5 09:10:59 2018
@@ -17,7 +17,7 @@ if (-e 'test_dir') { # runnin
}
use strict;
-use Test;
+use Test::More tests => 105;
use Mail::SpamAssassin;
use Mail::SpamAssassin::NetSet;
@@ -26,8 +26,6 @@ my $sa = Mail::SpamAssassin->new({
rules_filename => "$prefix/rules",
});
-plan tests => 105;
-
sub tryone ($$) {
my ($pat, $testip) = @_;
#warn "matching $testip gainst $pat\n";
Modified: spamassassin/trunk/t/lang_lint.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/lang_lint.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/lang_lint.t (original)
+++ spamassassin/trunk/t/lang_lint.t Mon Feb 5 09:10:59 2018
@@ -1,19 +1,15 @@
#!/usr/bin/perl
use lib '.'; use lib 't';
-use vars qw(@locales);
use SATest; sa_t_init("lang_lint");
-use constant TEST_ENABLED => conf_bool('run_long_tests');
-
-use Test; BEGIN {
- @locales = qw( de es fr it nl pl pl pt_BR );
- plan tests => (TEST_ENABLED ? scalar(@locales) : 0);
-};
-exit unless TEST_ENABLED;
+use Test::More;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan tests => 8;
# ---------------------------------------------------------------------------
+my @locales = qw( de es fr it nl pl pl pt_BR );
%patterns = ( q{ }, 'anything', );
for $locale (@locales) {
Modified: spamassassin/trunk/t/lang_pl_tests.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/lang_pl_tests.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/lang_pl_tests.t (original)
+++ spamassassin/trunk/t/lang_pl_tests.t Mon Feb 5 09:10:59 2018
@@ -1,16 +1,13 @@
#!/usr/bin/perl
-use lib '.';
+use lib '.';
use lib 't';
-use SATest;
+use SATest;
sa_t_init("lang_pl_tests");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_pl_tests');
-
-BEGIN { plan tests => (TEST_ENABLED ? 1 : 0) };
-
-exit unless TEST_ENABLED;
+use Test::More;
+plan skip_all => "pl tests disabled" unless conf_bool('run_pl_tests');
+plan tests => 1;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/line_endings.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/line_endings.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/line_endings.t (original)
+++ spamassassin/trunk/t/line_endings.t Mon Feb 5 09:10:59 2018
@@ -3,12 +3,9 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("line_endings");
-use constant TEST_ENABLED => conf_bool('run_long_tests');
-
-use Test; BEGIN {
- plan tests => (TEST_ENABLED ? 26 : 0);
-};
-exit unless TEST_ENABLED;
+use Test::More;
+plan skip_all => "Long running tests disabled" unless conf_bool('run_long_tests');
+plan tests => 26;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/lint_nocreate_prefs.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/lint_nocreate_prefs.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/lint_nocreate_prefs.t (original)
+++ spamassassin/trunk/t/lint_nocreate_prefs.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("lint_nocreate_prefs");
-use Test; BEGIN { plan tests => 2 };
+use Test::More tests => 2;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/make_install.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/make_install.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/make_install.t (original)
+++ spamassassin/trunk/t/make_install.t Mon Feb 5 09:10:59 2018
@@ -7,8 +7,7 @@ use SATest;
sa_t_init("make_install");
use Config;
-use Test;
-plan tests => 25;
+use Test::More tests => 25;
BEGIN {
if (-e 't/test_dir') {
Modified: spamassassin/trunk/t/mass_check.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/mass_check.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/mass_check.t (original)
+++ spamassassin/trunk/t/mass_check.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,8 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("mass_check");
-use Test; BEGIN { plan tests => 1 };
+
+use Test::More tests => 1;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/memory_cycles.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/memory_cycles.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/memory_cycles.t (original)
+++ spamassassin/trunk/t/memory_cycles.t Mon Feb 5 09:10:59 2018
@@ -20,13 +20,9 @@ if (-e 'test_dir') { # runnin
use lib '.'; use lib 't';
use SATest; sa_t_init("memory_cycles");
-use Test; BEGIN {
- plan tests => (HAVE_DEVEL_CYCLE ? 4 : 0);
-}
-unless (HAVE_DEVEL_CYCLE) {
- print "# Devel::Cycle module required for this test, skipped\n";
- exit 0;
-}
+use Test::More;
+plan skip_all => "Devel::Cycle module required for this test" unless HAVE_DEVEL_CYCLE;
+plan tests => 4;
use strict;
use Mail::SpamAssassin;
Modified: spamassassin/trunk/t/metadata.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/metadata.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/metadata.t (original)
+++ spamassassin/trunk/t/metadata.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("metadata");
-use Test; BEGIN { plan tests => 3 };
+use Test::More tests => 3;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/mimeheader.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/mimeheader.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/mimeheader.t (original)
+++ spamassassin/trunk/t/mimeheader.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("mimeheader");
-use Test; BEGIN { plan tests => 4 };
+use Test::More tests => 4;
$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we need the patterns to work
Modified: spamassassin/trunk/t/mimeparse.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/mimeparse.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/mimeparse.t (original)
+++ spamassassin/trunk/t/mimeparse.t Mon Feb 5 09:10:59 2018
@@ -17,7 +17,8 @@ if (-e 'test_dir') { # runnin
}
use strict;
-use Test;
+
+use Test::More tests => 33;
use Mail::SpamAssassin;
BEGIN {
@@ -107,13 +108,6 @@ my $sa = Mail::SpamAssassin->new({
dont_copy_prefs => 1,
});
-my $numtests = 5;
-while ( my($k,$v) = each %files ) {
- $numtests += @{$v};
-}
-
-plan tests => $numtests;
-
foreach my $k ( sort keys %files ) {
open(INP, $k) || die "Can't find $k:$!";
my $mail = $sa->parse(\*INP, 1);
Modified: spamassassin/trunk/t/missing_hb_separator.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/missing_hb_separator.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/missing_hb_separator.t (original)
+++ spamassassin/trunk/t/missing_hb_separator.t Mon Feb 5 09:10:59 2018
@@ -16,12 +16,12 @@ if (-e 'test_dir') { # runnin
}
use strict;
-use Test;
+
use lib '.'; use lib 't';
use SATest; sa_t_init("missing_hb_separator");
use Mail::SpamAssassin;
-plan tests => 13;
+use Test::More tests => 13;
# initialize SpamAssassin
my $sa = create_saobj({
Modified: spamassassin/trunk/t/mkrules.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/mkrules.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/mkrules.t (original)
+++ spamassassin/trunk/t/mkrules.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("mkrules");
-use Test; BEGIN { plan tests => 97 };
+use Test::More tests => 97;
use File::Copy;
use File::Path;
@@ -455,17 +455,21 @@ sub mkrun {
my $scrargs = "$perl_path -I../lib ../build/mkrules $args";
print ("\t$scrargs\n");
- system ("$scrargs > log/$testname.${Test::ntest} $post_redir");
+
+ my $test_number = test_number();
+ system ("$scrargs > log/$testname.$test_number $post_redir");
$mk_exitcode = ($?>>8);
if ($mk_exitcode != 0) { return undef; }
- &checkfile ("$testname.${Test::ntest}", $read_sub) if (defined $read_sub);
+ &checkfile ("$testname.$test_number", $read_sub) if (defined $read_sub);
1;
}
sub save_tdir {
- rmtree("$tdir.${Test::ntest}");
- if (move( "$tdir", "$tdir.${Test::ntest}")) {
- print "\ttest output tree copied to $tdir.${Test::ntest}\n";
+ my $test_number = test_number();
+
+ rmtree("$tdir.$test_number");
+ if (move( "$tdir", "$tdir.$test_number")) {
+ print "\ttest output tree copied to $tdir.$test_number\n";
}
}
Modified: spamassassin/trunk/t/mkrules_else.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/mkrules_else.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/mkrules_else.t (original)
+++ spamassassin/trunk/t/mkrules_else.t Mon Feb 5 09:10:59 2018
@@ -3,7 +3,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("mkrules_else");
-use Test; BEGIN { plan tests => 18 };
+use Test::More tests => 18;
use File::Copy;
use File::Path;
@@ -170,17 +170,21 @@ sub mkrun {
my $scrargs = "$perl_path -I../lib ../build/mkrules $args";
print ("\t$scrargs\n");
- system ("$scrargs > log/$testname.${Test::ntest} $post_redir");
+
+ my $test_number = test_number();
+ system ("$scrargs > log/$testname.$test_number $post_redir");
$mk_exitcode = ($?>>8);
if ($mk_exitcode != 0) { return undef; }
- &checkfile ("$testname.${Test::ntest}", $read_sub) if (defined $read_sub);
+ &checkfile ("$testname.$test_number", $read_sub) if (defined $read_sub);
1;
}
sub save_tdir {
- rmtree("$tdir.${Test::ntest}");
- if (move( "$tdir", "$tdir.${Test::ntest}")) {
- print "\ttest output tree copied to $tdir.${Test::ntest}\n";
+ my $test_number = test_number();
+
+ rmtree("$tdir.$test_number");
+ if (move( "$tdir", "$tdir.$test_number")) {
+ print "\ttest output tree copied to $tdir.$test_number\n";
}
}
Modified: spamassassin/trunk/t/nonspam.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/nonspam.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/nonspam.t (original)
+++ spamassassin/trunk/t/nonspam.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("nonspam");
-use Test; BEGIN { plan tests => 1 };
+use Test::More tests => 1;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/originating_ip_hdr.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/originating_ip_hdr.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/originating_ip_hdr.t (original)
+++ spamassassin/trunk/t/originating_ip_hdr.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("if_can");
-use Test; BEGIN { plan tests => 9 };
+use Test::More tests => 9;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/plugin.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/plugin.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/plugin.t (original)
+++ spamassassin/trunk/t/plugin.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("plugin");
-use Test; BEGIN { plan tests => 6 };
+use Test::More tests => 6;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/plugin_file.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/plugin_file.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/plugin_file.t (original)
+++ spamassassin/trunk/t/plugin_file.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("plugin_file");
-use Test; BEGIN { plan tests => 9 };
+use Test::More tests => 9;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/plugin_priorities.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/plugin_priorities.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/plugin_priorities.t (original)
+++ spamassassin/trunk/t/plugin_priorities.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("plugin_priorities");
-use Test; BEGIN { plan tests => 2 };
+use Test::More tests => 2;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/prefs_include.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/prefs_include.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/prefs_include.t (original)
+++ spamassassin/trunk/t/prefs_include.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("prefs_include");
-use Test; BEGIN { plan tests => 3 };
+use Test::More tests => 3;
$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we need the patterns to work
Modified: spamassassin/trunk/t/priorities.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/priorities.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/priorities.t (original)
+++ spamassassin/trunk/t/priorities.t Mon Feb 5 09:10:59 2018
@@ -1,7 +1,5 @@
#!/usr/bin/perl
-use constant NUM_TESTS => 10;
-
BEGIN {
if (-e 't/test_dir') { # if we are running "t/priorities.t", kluge around ...
chdir 't';
@@ -20,7 +18,7 @@ if (-e 'test_dir') { # runnin
use lib '.'; use lib 't';
use SATest; sa_t_init("priorities");
use strict;
-use Test; BEGIN { plan tests => NUM_TESTS };
+use Test::More tests => 10;
use Mail::SpamAssassin;
Modified: spamassassin/trunk/t/razor2.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/razor2.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/razor2.t (original)
+++ spamassassin/trunk/t/razor2.t Mon Feb 5 09:10:59 2018
@@ -3,20 +3,14 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("razor2");
-use constant TEST_ENABLED => conf_bool('run_net_tests');
use constant HAS_RAZOR2 => eval { require Razor2::Client::Agent; };
-use Test;
+use Test::More;
+plan skip_all => "Net tests disabled" unless conf_bool('run_net_tests');
+plan skip_all => "Needs Razor2" unless HAS_RAZOR2;
+plan tests => 2;
-BEGIN {
- plan tests => ((TEST_ENABLED && HAS_RAZOR2) ? 2 : 0),
- onfail => sub {
- warn "\n\nNote: this may not be an SpamAssassin bug, as Razor tests can" .
- "\nfail due to problems with the Razor servers.\n\n";
- }
-};
-
-exit unless (TEST_ENABLED && HAS_RAZOR2);
+diag('Note: Failures may not be an SpamAssassin bug, as Razor tests can fail due to problems with the Razor servers.');
# ---------------------------------------------------------------------------
@@ -44,7 +38,7 @@ loadplugin Mail::SpamAssassin::Plugin::R
);
sarun ("-t < data/spam/001", \&patterns_run_cb);
-skip_all_patterns($razor_not_available);
+plan skip_all_patterns($razor_not_available);
#TESTING FOR HAM
%patterns = ();
@@ -53,4 +47,4 @@ skip_all_patterns($razor_not_available);
);
sarun ("-t < data/nice/001", \&patterns_run_cb);
-skip_all_patterns($razor_not_available);
+plan skip_all_patterns($razor_not_available);
Modified: spamassassin/trunk/t/rcvd_parser.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/rcvd_parser.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/rcvd_parser.t (original)
+++ spamassassin/trunk/t/rcvd_parser.t Mon Feb 5 09:10:59 2018
@@ -18,7 +18,7 @@ if (-e 'test_dir') { # runnin
use lib '.'; use lib 't';
use SATest; sa_t_init("rcvd_parser");
-use Test; BEGIN { plan tests => 147 };
+use Test::More tests => 147;
use strict;
# format is:
Modified: spamassassin/trunk/t/re_base_extraction.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/re_base_extraction.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/re_base_extraction.t (original)
+++ spamassassin/trunk/t/re_base_extraction.t Mon Feb 5 09:10:59 2018
@@ -5,7 +5,7 @@
use lib '.'; use lib 't'; use lib '../lib';
use SATest; sa_t_init("re_base_extraction");
-use Test;
+
use strict;
use warnings;
@@ -21,10 +21,9 @@ close STDIN; # inhibits noise from sa
BEGIN {
if (-e 't/test_dir') { chdir 't'; }
if (-e 'test_dir') { unshift(@INC, '../blib/lib'); }
+}
- plan tests => 128;
-
-};
+use Test::More tests => 128;
use lib '../lib';
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/recips.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/recips.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/recips.t (original)
+++ spamassassin/trunk/t/recips.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,8 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("recips");
-use Test; BEGIN { plan tests => 6 };
+
+use Test::More tests => 6;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/recreate.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/recreate.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/recreate.t (original)
+++ spamassassin/trunk/t/recreate.t Mon Feb 5 09:10:59 2018
@@ -3,7 +3,7 @@
use Data::Dumper;
use lib '.'; use lib 't';
use SATest; sa_t_init("recreate");
-use Test;
+use Test::More tests => 9;
BEGIN {
if (-e 't/test_dir') {
@@ -13,8 +13,6 @@ BEGIN {
if (-e 'test_dir') {
unshift(@INC, '../blib/lib');
}
-
- plan tests => 9;
};
use strict;
Modified: spamassassin/trunk/t/recursion.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/recursion.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/recursion.t (original)
+++ spamassassin/trunk/t/recursion.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("recursion");
-use Test; BEGIN { plan tests => 10 };
+use Test::More tests => 10;
use IO::File;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/regexp_valid.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/regexp_valid.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/regexp_valid.t (original)
+++ spamassassin/trunk/t/regexp_valid.t Mon Feb 5 09:10:59 2018
@@ -18,10 +18,8 @@ if (-e 'test_dir') { # runnin
use strict;
use lib '.'; use lib 't';
use SATest; sa_t_init("regexp_valid");
-use Test;
-# settings
-plan tests => 24;
+use Test::More tests => 24;
# initialize SpamAssassin
use Mail::SpamAssassin;
Modified: spamassassin/trunk/t/relative_scores.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/relative_scores.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/relative_scores.t (original)
+++ spamassassin/trunk/t/relative_scores.t Mon Feb 5 09:10:59 2018
@@ -13,7 +13,7 @@ BEGIN {
use lib '.'; use lib 't';
use SATest; sa_t_init("relative_scores");
-use Test;
+
use strict;
use vars qw/ $error /;
@@ -39,7 +39,7 @@ my $sa = create_saobj();
$sa->init(0); # parse rules
-plan tests => 4;
+use Test::More tests => 4;
ok($sa);
Modified: spamassassin/trunk/t/report_safe.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/report_safe.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/report_safe.t (original)
+++ spamassassin/trunk/t/report_safe.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,8 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("report_safe");
-use Test; BEGIN { plan tests => 8 };
+
+use Test::More tests => 8;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/reportheader.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/reportheader.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/reportheader.t (original)
+++ spamassassin/trunk/t/reportheader.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,8 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("reportheader");
-use Test; BEGIN { plan tests => 11 };
+
+use Test::More tests => 11;
$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we need the patterns to work
Modified: spamassassin/trunk/t/reportheader_8bit.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/reportheader_8bit.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/reportheader_8bit.t (original)
+++ spamassassin/trunk/t/reportheader_8bit.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,8 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("reportheader");
-use Test; BEGIN { plan tests => 3 };
+
+use Test::More tests => 3;
$ENV{'LANGUAGE'} = $ENV{'LC_ALL'} = 'C'; # a cheat, but we need the patterns to work
Modified: spamassassin/trunk/t/reuse.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/reuse.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/reuse.t (original)
+++ spamassassin/trunk/t/reuse.t Mon Feb 5 09:10:59 2018
@@ -18,19 +18,14 @@ if (-e 'test_dir') { # runnin
use strict;
use lib '.'; use lib 't';
use SATest; sa_t_init("reuse");
-use Test;
use vars qw(%patterns %anti_patterns $perl_path &patterns_run_cb);
use Mail::SpamAssassin;
-if (-e '../masses/mass-check') {
- plan tests => 37;
-}
-else {
- plan tests => 0;
- exit;
-}
+use Test::More;
+plan skip_all => "no mass check" unless (-e '../masses/mass-check');
+plan tests => 37;
# Tests the following cases:
# - No reuse: no change
Modified: spamassassin/trunk/t/root_spamd.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd.t (original)
+++ spamassassin/trunk/t/root_spamd.t Mon Feb 5 09:10:59 2018
@@ -4,14 +4,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 14 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 14;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_tell.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_tell.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_tell.t (original)
+++ spamassassin/trunk/t/root_spamd_tell.t Mon Feb 5 09:10:59 2018
@@ -2,14 +2,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_tell");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 6 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 6;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_tell_paranoid.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_tell_paranoid.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_tell_paranoid.t (original)
+++ spamassassin/trunk/t/root_spamd_tell_paranoid.t Mon Feb 5 09:10:59 2018
@@ -2,14 +2,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_tell_paranoid");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 6 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 6;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_tell_x.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_tell_x.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_tell_x.t (original)
+++ spamassassin/trunk/t/root_spamd_tell_x.t Mon Feb 5 09:10:59 2018
@@ -2,14 +2,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_tell_x");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 6 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 6;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_tell_x_paranoid.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_tell_x_paranoid.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_tell_x_paranoid.t (original)
+++ spamassassin/trunk/t/root_spamd_tell_x_paranoid.t Mon Feb 5 09:10:59 2018
@@ -2,14 +2,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_tell_x_paranoid");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 6 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 6;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_u.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_u.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_u.t (original)
+++ spamassassin/trunk/t/root_spamd_u.t Mon Feb 5 09:10:59 2018
@@ -4,14 +4,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_u");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 11 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 11;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_u_dcc.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_u_dcc.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_u_dcc.t (original)
+++ spamassassin/trunk/t/root_spamd_u_dcc.t Mon Feb 5 09:10:59 2018
@@ -5,15 +5,12 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_u_dcc");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant DCC_TEST_ENABLED => conf_bool('run_dcc_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && DCC_TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 23 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "DCC tests disabled" unless conf_bool('run_dcc_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 23;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_virtual.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_virtual.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_virtual.t (original)
+++ spamassassin/trunk/t/root_spamd_virtual.t Mon Feb 5 09:10:59 2018
@@ -4,14 +4,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_virtual");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 14 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 14;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_x.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_x.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_x.t (original)
+++ spamassassin/trunk/t/root_spamd_x.t Mon Feb 5 09:10:59 2018
@@ -2,14 +2,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_x");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 14 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 14;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_x_paranoid.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_x_paranoid.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_x_paranoid.t (original)
+++ spamassassin/trunk/t/root_spamd_x_paranoid.t Mon Feb 5 09:10:59 2018
@@ -2,14 +2,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_x_paranoid");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 14 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 14;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/root_spamd_x_u.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/root_spamd_x_u.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/root_spamd_x_u.t (original)
+++ spamassassin/trunk/t/root_spamd_x_u.t Mon Feb 5 09:10:59 2018
@@ -4,14 +4,11 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("root_spamd_x_u");
-use Test;
-use constant TEST_ENABLED => conf_bool('run_root_tests');
-use constant IS_ROOT => eval { ($> == 0); };
-use constant RUN_TESTS => (TEST_ENABLED && IS_ROOT);
-
-BEGIN { plan tests => (RUN_TESTS ? 14 : 0) };
-exit unless RUN_TESTS;
+use Test::More;
+plan skip_all => "root tests disabled" unless conf_bool('run_root_tests');
+plan skip_all => "not running tests as root" unless eval { ($> == 0); };
+plan tests => 14;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/rule_multiple.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/rule_multiple.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/rule_multiple.t (original)
+++ spamassassin/trunk/t/rule_multiple.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,7 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("rule_multiple");
-use Test; BEGIN { plan tests => 20 };
+use Test::More tests => 20;
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/rule_names.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/rule_names.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/rule_names.t (original)
+++ spamassassin/trunk/t/rule_names.t Mon Feb 5 09:10:59 2018
@@ -28,17 +28,8 @@ BEGIN {
our $RUN_THIS_TEST;
-use Test;
-BEGIN {
- $RUN_THIS_TEST = conf_bool('run_rule_name_tests');
-
- plan tests => 0 if !$RUN_THIS_TEST;
-};
-
-if (!$RUN_THIS_TEST) {
- print "NOTE: this test requires 'run_rule_name_tests' set to 'y'.\n";
- exit;
-}
+use Test::More;
+plan skip_all => "This test requires 'run_rule_name_tests' set to 'y'." unless conf_bool('run_rule_name_tests');
use vars qw(%patterns %anti_patterns);
@@ -77,12 +68,9 @@ for my $test (@tests) {
{ # couldn't call Test::plan in a BEGIN phase, the %patterns and %anti_patterns
# must be assembled first in order to get the planned test count
- plan tests => scalar(keys %anti_patterns) + scalar(keys %patterns),
+ plan tests => scalar(keys %anti_patterns) + scalar(keys %patterns);
- onfail => sub {
- warn "\n\n Note: rule_name failures may be only cosmetic" .
- "\n but must be fixed before release\n\n";
- };
+ diag "Note: rule_name failures may be only cosmetic but must be fixed before release";
};
# ---------------------------------------------------------------------------
Modified: spamassassin/trunk/t/rule_tests.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/rule_tests.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/rule_tests.t (original)
+++ spamassassin/trunk/t/rule_tests.t Mon Feb 5 09:10:59 2018
@@ -15,15 +15,15 @@ if (-e 'test_dir') { # runnin
$prefix = '..';
}
-use SATest;
+use lib '.';
+use SATest;
sa_t_init("rule_tests");
use strict;
-use Test;
+use Test::More;
use Mail::SpamAssassin;
-use vars qw($num_tests);
-$num_tests = 1;
+my $num_tests = 1;
$Mail::SpamAssassin::Conf::COLLECT_REGRESSION_TESTS = 1;
@@ -160,7 +160,6 @@ foreach my $tests (@tests) {
# debugging, what rule hits actually occurred
#print $symbol, ": ", join(", ", keys(%rules_hit), "\n");
- print "Test for '$symbol' (type: $test_type) against '$string'\n";
- ok( (exists $rules_hit{$symbol} ? 1 : 0), ($ok_or_fail eq 'ok' ? 1 : 0), "Test for '$symbol' (type: $test_type) against '$string'" );
+ is( (exists $rules_hit{$symbol} ? 1 : 0), ($ok_or_fail eq 'ok' ? 1 : 0), "Test for '$symbol' (type: $test_type) against '$string'" );
}
Modified: spamassassin/trunk/t/rule_types.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/rule_types.t?rev=1823143&r1=1823142&r2=1823143&view=diff
==============================================================================
--- spamassassin/trunk/t/rule_types.t (original)
+++ spamassassin/trunk/t/rule_types.t Mon Feb 5 09:10:59 2018
@@ -2,7 +2,8 @@
use lib '.'; use lib 't';
use SATest; sa_t_init("rule_types");
-use Test; BEGIN { plan tests => 9 };
+
+use Test::More tests => 9;
# ---------------------------------------------------------------------------