This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Let's remove the grep in void context warning.
[perl5.git] / t / lib / mypragma.t
CommitLineData
32645610
NC
1#!./perl
2
3BEGIN {
4 chdir 't';
5 @INC = ('../lib', 'lib');
6}
7
8use strict;
9use warnings;
2643c356 10use Test::More tests => 13;
32645610
NC
11
12use mypragma (); # don't enable this pragma yet
13
14BEGIN {
15 is($^H{mypragma}, undef, "Shouldn't be in %^H yet");
16}
17
18is(mypragma::in_effect(), undef, "pragma not in effect yet");
19{
f52edb18
NC
20 is(mypragma::in_effect(), undef, "pragma not in effect yet");
21 eval qq{is(mypragma::in_effect(), undef, "pragma not in effect yet"); 1}
22 or die $@;
23
32645610 24 use mypragma;
fd9f6265
JJ
25 is(mypragma::in_effect(), 42, "pragma is in effect within this block");
26 eval qq{is(mypragma::in_effect(), 42,
f52edb18 27 "pragma is in effect within this eval"); 1} or die $@;
2643c356
NC
28
29 {
30 no mypragma;
31 is(mypragma::in_effect(), 0, "pragma no longer in effect");
32 eval qq{is(mypragma::in_effect(), 0, "pragma no longer in effect"); 1}
33 or die $@;
34 }
35
fd9f6265
JJ
36 is(mypragma::in_effect(), 42, "pragma is in effect within this block");
37 eval qq{is(mypragma::in_effect(), 42,
2643c356 38 "pragma is in effect within this eval"); 1} or die $@;
32645610
NC
39}
40is(mypragma::in_effect(), undef, "pragma no longer in effect");
f52edb18 41eval qq{is(mypragma::in_effect(), undef, "pragma not in effect"); 1} or die $@;
32645610
NC
42
43
44BEGIN {
45 is($^H{mypragma}, undef, "Should no longer be in %^H");
46}