summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsher Mancinelli <asher.mancinelli@pnnl.gov>2021-04-23 10:17:33 -0600
committerLeon Timmermans <fawaka@gmail.com>2021-08-15 13:40:54 +0200
commit7656d14da076307d67e322c07d470d4ce8f57474 (patch)
tree82606fd8e39ff24387161d0039d51223ec8618f5
parent776421bfdc568f8da877526dcb83803be42776c7 (diff)
downloadperl-7656d14da076307d67e322c07d470d4ce8f57474.tar.gz
Test new warnings enabled by default
-rw-r--r--t/op/ver.t19
1 files changed, 18 insertions, 1 deletions
diff --git a/t/op/ver.t b/t/op/ver.t
index 35994df62b..3631dd057f 100644
--- a/t/op/ver.t
+++ b/t/op/ver.t
@@ -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; $@");
@@ -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!