]> git.vpit.fr Git - perl/modules/autovivification.git/blob - t/42-deparse.t
436b03d2bc4d9472ea1f1b5a8ca61361c6bab4b4
[perl/modules/autovivification.git] / t / 42-deparse.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More;
7
8 use lib 't/lib';
9 use VPIT::TestHelpers;
10
11 load_or_skip('B::Deparse', undef, [ ],
12              'required to test round-trip deparsing compatibility');
13
14 plan tests => 2;
15
16 my $bd = B::Deparse->new;
17
18 {
19  no autovivification qw<fetch strict>;
20
21  sub blech { my $key = $_[0]->{key} }
22 }
23
24 {
25  my $undef;
26  eval 'blech($undef)';
27  like $@, qr/Reference vivification forbidden/, 'Original blech() works';
28 }
29
30 {
31  my $code = $bd->coderef2text(\&blech);
32  my $undef;
33  eval "$code; blech(\$undef)";
34  like $@, qr/Reference vivification forbidden/, 'Deparsed blech() works';
35 }