This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
locale.t: Move test plan to end
authorKarl Williamson <public@khwilliamson.com>
Sun, 15 Jan 2012 18:16:57 +0000 (11:16 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sat, 21 Jan 2012 17:02:52 +0000 (10:02 -0700)
The current code goes through a lot of machinations to know
1..n
at the beginning.  Nowadays, one can simply calculate this as we go
along and print it out at the end.  If the test fails in the middle, the
lack of a plan will be marked as a failure.

lib/locale.t

index 690a173..89a87ab 100644 (file)
@@ -57,10 +57,6 @@ $have_setlocale = 0 if ((($^O eq 'MSWin32' && !$winxp) || $^O eq 'NetWare') &&
 $have_setlocale = 0 if ($^O =~ /^uwin/);
 
 my $last_locales = $have_setlocale ? &last_locales : &last_without_setlocale;
-my $last = $have_setlocale ? &last : &last_without_setlocale;
-
-print "1..$last\n";
-
 sub LC_ALL ();
 
 $a = 'abc %';
@@ -259,7 +255,10 @@ sub last_without_setlocale { 98 }
 # Let us do some *real* locale work now,
 # unless setlocale() is missing (i.e. minitest).
 
-exit unless $have_setlocale;
+unless ($have_setlocale) {
+    print "1..$test_num\n";
+    exit;
+}
 
 # Find locales.
 
@@ -1007,6 +1006,6 @@ setlocale(LC_ALL, "C");
 }
 
 
-sub last { 165 }
+print "1..$test_num\n";
 
 # eof