@@ -931,7 +931,9 @@ for my $strict ("", "no warnings 'experimental::re_strict'; use re 'strict';")
931931 diag(" GOT\n '$got [$i ]'\n EXPECT\n '$expect [$i ]'" );
932932 }
933933 else {
934- ok (0 == capture_warnings(sub {
934+ # Turning off this type of warning should make the
935+ # count go down by at least 1.
936+ ok ($count - 1 >= capture_warnings(sub {
935937 $_ = " x" ;
936938 eval " $strict no warnings '$warning_type '; $regex ;" }
937939 ),
@@ -941,11 +943,20 @@ for my $strict ("", "no warnings 'experimental::re_strict'; use re 'strict';")
941943 # correct. This test relies on the fact that we
942944 # are outside the scope of any ‘use warnings’.
943945 local $^W;
944- my @warns = capture_warnings(sub { $_ = " x" ;
945- eval " $strict $regex " });
946+ my $turn_off_sets =
947+ ($ref == \@experimental_regex_sets )
948+ ? " "
949+ : " no warnings 'experimental::regex_sets';" ;
950+ my @warns = capture_warnings(sub {
951+ $_ = " x" ;
952+ eval " $strict $turn_off_sets $regex "
953+ });
946954 # Warning should be on as well if is testing
947955 # '(?[...])' which turns on strict
948- if ($this_default_on || grep { $_ =~ / \Q (?[/ } @expect ) {
956+ if ( $this_default_on
957+ || ( grep { $_ =~ / \Q (?[/ } @expect
958+ and $ref != \@warning_tests ))
959+ {
949960 ok @warns > 0, " ... and the warning is on by default" ;
950961 }
951962 elsif (! (ok @warns == 0,
0 commit comments