File: demolish-global_destruction.t

package info (click to toggle)
libmoo-perl 2.005005-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 840 kB
  • sloc: perl: 2,506; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 585 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use strict;
use warnings;
use lib 't/lib';

use Test::More;
use CaptureException;
use File::Basename qw(dirname);

BEGIN {
  package Foo;
  use Moo;

  sub DEMOLISH {
    my $self = shift;
    my ($igd) = @_;
    ::ok !$igd,
      'in_global_destruction state is passed to DEMOLISH properly (false)';
  }
}

{
  my $foo = Foo->new;
}

delete $ENV{PERL5LIB};
delete $ENV{PERL5OPT};
my $out = system $^X, (map "-I$_", @INC), dirname(__FILE__).'/global-destruction-helper.pl', 219;
is $out >> 8, 219,
  'in_global_destruction state is passed to DEMOLISH properly (false)';

done_testing;