This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Convert t/re/reg_email.t to test.pl, strict and warnings.
authorNicholas Clark <nick@ccl4.org>
Sun, 13 Mar 2011 15:49:50 +0000 (15:49 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 13 Mar 2011 15:49:50 +0000 (15:49 +0000)
t/re/reg_email.t

index 6255ee3..27f1f35 100644 (file)
@@ -1,4 +1,4 @@
-#!./perl
+#!./perl -w
 #
 # Tests to make sure the regexp engine doesn't run into limits too soon.
 #
@@ -6,9 +6,10 @@
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
+    require './test.pl';
 }
 
-print "1..13\n";
+use strict;
 
 my $email = qr {
     (?(DEFINE)
@@ -66,13 +67,9 @@ my $email = qr {
     (?&address)
 }x;
 
-
 run_tests() unless caller;
 
 sub run_tests {
-    my $count = 0;
-
-    $| = 1;
     # rewinding DATA is necessary with PERLIO=stdio when this
     # test is run from another thread
     seek *DATA, 0, 0;
@@ -80,10 +77,14 @@ sub run_tests {
     while (<DATA>) {
        chomp;
        next if /^#/;
-       print /^$email$/ ? "ok " : "not ok ", ++ $count, "\n";
+       like($_, qr/^$email$/, $_);
     }
+
+    done_testing();
 }
 
+1; # Because reg_email_thr.t will (indirectly) require this script.
+
 #
 # Acme::MetaSyntactic ++
 #