summaryrefslogtreecommitdiff
path: root/t/porting/diag.t
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-09-06 11:05:52 +0200
committerYves Orton <demerphq@gmail.com>2022-09-08 07:55:45 +0200
commit701682f9bcc2e687fc0220a8e1e00462b3561c1c (patch)
tree4396782c18dc4f7087de54f9dbf64b0d93343e34 /t/porting/diag.t
parent077b44c7321d21b70dfdc26bc03d96b62d785cb8 (diff)
downloadperl-701682f9bcc2e687fc0220a8e1e00462b3561c1c.tar.gz
diag.t - show what needs to be removed to un-TODO a test
The old message was a little less than helpful. The new one shows the file and line to remove.
Diffstat (limited to 't/porting/diag.t')
-rw-r--r--t/porting/diag.t18
1 files changed, 15 insertions, 3 deletions
diff --git a/t/porting/diag.t b/t/porting/diag.t
index 3f56e9201b..cf2851c1f9 100644
--- a/t/porting/diag.t
+++ b/t/porting/diag.t
@@ -58,12 +58,20 @@ my $bad_version_re = qr{BADVERSION\([^"]*$text_re};
my $regcomp_call_re = qr/$regcomp_re.*?$text_re/;
my %entries;
-
+my $data_start_line= 0;
# Get the ignores that are compiled into this file
my $reading_categorical_exceptions;
+# reset the DATA point to the top of the file, read until we find __DATA__
+# so that $. is "correct" for our purposes.
+seek DATA, 0, 0;
+while (<DATA>) {
+ /^__DATA__/ and last;
+}
while (<DATA>) {
chomp;
+ next if /^\s*#/ and !/\S/;
$entries{$_}{todo} = 1;
+ $entries{$_}{todo_line}= $data_start_line + $.;
$reading_categorical_exceptions and $entries{$_}{cattodo}=1;
/__CATEGORIES__/ and ++$reading_categorical_exceptions;
}
@@ -112,13 +120,16 @@ while (<$diagfh>) {
if (exists $entries{$cur_entry} && $entries{$cur_entry}{todo}
&& !$entries{$cur_entry}{cattodo}) {
+ my $data_line= $entries{$cur_entry}{todo_line};
TODO: {
- local $::TODO = "Remove the TODO entry \"$cur_entry\" from DATA as it is already in $pod near line $.";
+ local $::TODO = "Remove the TODO entry \"$cur_entry\" from DATA "
+ . "at $0 line $data_line as it is already in $pod near line $.";
ok($cur_entry);
}
}
# Make sure to init this here, so an actual entry in perldiag
# overwrites one in DATA.
+ # diag("adding '$cur_entry'");
$entries{$cur_entry}{todo} = 0;
$entries{$cur_entry}{line_number} = $.;
}
@@ -336,7 +347,7 @@ sub check_file {
s/ (?<!%) % $format_modifiers ( [dioxXucsfeEgGp] ) /%$1/xg;
# The %"foo" thing needs to happen *before* this regex.
- #diag(">$_<");
+ # diag(">$_<");
# DIE is just return Perl_die
my ($name, $category, $routine, $wrapper);
if (/\b$source_msg_call_re/) {
@@ -465,6 +476,7 @@ sub check_message {
TODO: {
no warnings 'once';
local $::TODO = 'in DATA';
+ # diag(Dumper($entries{$key}));
# There is no listing, but it is in the list of exceptions. TODO FAIL.
fail($key);
diag(