Skip to content

Commit

Permalink
Add tests for -W and -X
Browse files Browse the repository at this point in the history
  • Loading branch information
Leont committed Sep 9, 2023
1 parent 5793d42 commit bc2bdb5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions t/run/switches.t
Original file line number Diff line number Diff line change
Expand Up @@ -724,4 +724,32 @@ SWTEST
like( $r, qr/ok/, 'Spaces on the #! line (#30660)' );
}

$r = runperl(
switches => [ '-W', ],
prog => 'my $b = $a + 0',
stderr => 1,
);
is( $r, "Use of uninitialized value \$a in addition (+) at -e line 1.\n", "-W" );

$r = runperl(
switches => [ '-W', ],
prog => 'no warnings; my $b = $a + 0',
stderr => 1,
);
is( $r, "Use of uninitialized value \$a in addition (+) at -e line 1.\n", "-W with no warnings" );

$r = runperl(
switches => [ '-X', ],
prog => 'use warnings; my $b = $a + 0',
stderr => 1,
);
is( $r, "", "-X with use warnings" );

$r = runperl(
switches => [ '-X', ],
prog => 'use 5.036; my $b = $a + 0',
stderr => 1,
);
is( $r, "", "-X with use 5.36" );

done_testing();

0 comments on commit bc2bdb5

Please sign in to comment.