4 chdir '..' if -d '../pod' && -d '../t';
8 use Test::More tests => 9;
12 $SIG{__WARN__} = sub { $w = shift };
13 use_ok('diagnostics');
14 is $w, undef, 'no warnings when loading diagnostics.pm';
20 'base'->import(qw(I::do::not::exist));
23 like( $@, qr/^Base class package "I::do::not::exist" is empty/);
25 # Test for %.0f patterns in perldiag, added in 5.11.0
27 open STDERR, ">", \my $warning
28 or die "Couldn't redirect STDERR to var: $!";
29 warn('gmtime(nan) too large');
30 like $warning, qr/\(W overflow\) You called/, '%0.f patterns';
35 warn("accept() on closed socket spanner");
36 like $warning, qr/"accept" in perlfunc/, 'L<foo/bar> links';
38 # L<foo|bar/baz> links
42 'Lexing code attempted to stuff non-Latin-1 character into Latin-1 input';
43 like $warning, qr/using lex_stuff_pvn or similar/, 'L<foo|bar/baz>';
45 # Multiple messages with the same description
48 warn 'Code point 0x%X is not Unicode, may not be portable';
49 like $warning, qr/W utf8/,
50 'Message sharing its description with the following message';
52 # Periods at end of entries in perldiag.pod get matched correctly
55 warn "Execution of -e aborted due to compilation errors.\n";
56 like $warning, qr/The final summary message/, 'Periods at end of line';
62 warn "Bad arg length for us, is 4, should be 42";
63 like $warning, qr/In C parlance/, '%u works';