Skip to content

Commit

Permalink
Test new warnings enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ashermancinelli authored and Leont committed May 27, 2021
1 parent 53996b6 commit ae9b784
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion t/op/ver.t
Expand Up @@ -12,7 +12,7 @@ $DOWARN = 1; # enable run-time warnings now

use Config;

plan( tests => 52 );
plan( tests => 54 );

eval 'use v5.5.640';
is( $@, '', "use v5.5.640; $@");
Expand Down Expand Up @@ -267,5 +267,22 @@ sub { $_[0] = v3;
*{"\3"} = *DATA;
is( (readline v3), "This is what we expect to see!\n", "v-strings even work in Mordor" );

{
# disable warnings just for the following test
local $DOWARN = 0;

# Keep a list of all warnings issued in this test
my @warnings = ();
local $SIG{__WARN__} = sub { push @warnings, @_; };

# This should *not* result in a warning
eval { my $foo; "This doesn't need to be here...".$foo; };
is( scalar @warnings, 0, "Warnings are disabled by default pre 5.35" );

# This *should* result in a warning
eval { use v5.035; my $foo; "This doesn't need to be here...".$foo; };
is( scalar @warnings, 1, "Warnings are enabled by default post 5.35" );
}

__DATA__
This is what we expect to see!

0 comments on commit ae9b784

Please sign in to comment.