From b8fdcb87fcc72661f9a47b0f51b2c9b0f44a5235 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sun, 11 Apr 2021 20:49:59 -0600 Subject: [PATCH] t/loc_tools.pl: Print better failing test numbers This test module is 'required' from other perl test files. If it encounters an error, it doesn't know how to report it. What it does is call fail() if available, and a home-grown one otherwise. Prior to this commit the home-grown version just made all tests number 0. This commit changes that to make them sequentially numbered from a very high starting one, so as not to interfere with the outer calls. --- t/loc_tools.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/loc_tools.pl b/t/loc_tools.pl index 3076f632de6b..b062e0dd4714 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -83,6 +83,9 @@ ($) } } +# Larger than any real test +my $my_count = 1_000_000; + sub _my_fail($) { my $message = shift; if (defined &main::fail) { @@ -90,7 +93,7 @@ ($) } else { local($\, $", $,) = (undef, ' ', ''); - print "not ok 0 $message\n"; + print "not ok " . $my_count++ . $message . "\n"; } } @@ -538,12 +541,12 @@ ($) my $save_locale = setlocale(&POSIX::LC_CTYPE()); if (! $save_locale) { - ok(0, "Verify could save previous locale"); + _my_fail("Verify could save previous locale"); return 0; } if (! setlocale(&POSIX::LC_CTYPE(), $locale)) { - ok(0, "Verify could setlocale to $locale"); + _my_fail("Verify could setlocale to $locale"); return 0; } @@ -556,7 +559,7 @@ ($) # go through testing all the locales on the platform. if (CORE::fc(chr utf8::unicode_to_native(0xdf)) ne "ss") { if ($locale =~ /UTF-?8/i) { - ok (0, "Verify $locale with UTF-8 in name is a UTF-8 locale"); + _my_fail("Verify $locale with UTF-8 in name is a UTF-8 locale"); } } else {