This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Die on malformed isFOO_utf8() input
[perl5.git] / t / lib / mypragma.t
CommitLineData
32645610
NC
1#!./perl
2
eaa79d3d 3BEGIN {
b5efbd1f 4 chdir 't' if -d 't';
eaa79d3d 5 require './test.pl';
3fe9640a 6 @INC = qw(lib ../lib);
eaa79d3d
NC
7 plan(tests => 14);
8}
32645610 9
3fe9640a
JH
10use strict;
11use warnings;
12
32645610
NC
13use mypragma (); # don't enable this pragma yet
14
15BEGIN {
16 is($^H{mypragma}, undef, "Shouldn't be in %^H yet");
17}
18
19is(mypragma::in_effect(), undef, "pragma not in effect yet");
20{
f52edb18
NC
21 is(mypragma::in_effect(), undef, "pragma not in effect yet");
22 eval qq{is(mypragma::in_effect(), undef, "pragma not in effect yet"); 1}
23 or die $@;
24
32645610 25 use mypragma;
27eaf14c 26 use Sans_mypragma;
fd9f6265 27 is(mypragma::in_effect(), 42, "pragma is in effect within this block");
27eaf14c
RD
28 is(Sans_mypragma::affected(), undef,
29 "pragma not in effect outside this file");
fd9f6265 30 eval qq{is(mypragma::in_effect(), 42,
f52edb18 31 "pragma is in effect within this eval"); 1} or die $@;
2643c356
NC
32
33 {
34 no mypragma;
35 is(mypragma::in_effect(), 0, "pragma no longer in effect");
36 eval qq{is(mypragma::in_effect(), 0, "pragma no longer in effect"); 1}
37 or die $@;
38 }
39
fd9f6265
JJ
40 is(mypragma::in_effect(), 42, "pragma is in effect within this block");
41 eval qq{is(mypragma::in_effect(), 42,
2643c356 42 "pragma is in effect within this eval"); 1} or die $@;
32645610
NC
43}
44is(mypragma::in_effect(), undef, "pragma no longer in effect");
f52edb18 45eval qq{is(mypragma::in_effect(), undef, "pragma not in effect"); 1} or die $@;
32645610
NC
46
47
48BEGIN {
49 is($^H{mypragma}, undef, "Should no longer be in %^H");
50}