summaryrefslogtreecommitdiff
path: root/lib/diagnostics.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-02-12 18:05:14 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-02-12 18:05:14 -0800
commit4b056c0626143ea9b19431c50c5587207f7bfc77 (patch)
tree1b9a9ea55f9a5500dc4ddd25ace548d097c07c24 /lib/diagnostics.t
parent070bca2dc77f646ea2d6f71077e2008c790ba9ca (diff)
downloadperl-4b056c0626143ea9b19431c50c5587207f7bfc77.tar.gz
Improve diagnostics.pm’s link rendering.
The number of L<foo/bar> links in perldiag has grown over time, and diagnostics.pm has never been updated to render them nicely, resulting in output like this: Lexing code attempted to stuff non-Latin-1 character into Latin-1 input at lib/diagnostics.t line 36 (#3) (F) An extension is attempting to insert text into the current parse (using lex_stuff_pvn_flags|perlapi/lex_stuff_pvn_flags or similar), but tried to insert a character that couldn't be part of the current input. This is an inherent pitfall of the stuffing mechanism, and one of the reasons to avoid it. Where it is necessary to stuff, stuffing only plain ASCII is recommended. I’ve implemented some rudimentary L<> parsing, which should suffice for perldiag. I think using a real POD processor would be overkill.
Diffstat (limited to 'lib/diagnostics.t')
-rw-r--r--lib/diagnostics.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/diagnostics.t b/lib/diagnostics.t
index ee0c160743..81896cda64 100644
--- a/lib/diagnostics.t
+++ b/lib/diagnostics.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = 'lib';
}
-use Test::More tests => 3;
+use Test::More tests => 5;
BEGIN { use_ok('diagnostics') }
@@ -23,3 +23,16 @@ open STDERR, ">", \my $warning
or die "Couldn't redirect STDERR to var: $!";
warn('gmtime(nan) too large');
like $warning, qr/\(W overflow\) You called/, '%0.f patterns';
+
+# L<foo/bar> links
+seek STDERR, 0,0;
+$warning = '';
+warn("accept() on closed socket spanner");
+like $warning, qr/"accept" in perlfunc/, 'L<foo/bar> links';
+
+# L<foo|bar/baz> links
+seek STDERR, 0,0;
+$warning = '';
+warn
+ 'Lexing code attempted to stuff non-Latin-1 character into Latin-1 input';
+like $warning, qr/using lex_stuff_pvn_flags or similar/, 'L<foo|bar/baz>';