Missed a test that was badly testing for \n
[gitmo/Moose.git] / t / 010_basics / 020-global-destruction.t
CommitLineData
9a7f2b2d 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More tests => 2;
7
8our $expected_igd = 0;
9package Foo;
10use Moose;
11
12sub DEMOLISH {
13 my $self = shift;
14 my ($igd) = @_;
15 ::is($igd, $::expected_igd,
16 "in_global_destruction state is passed to DEMOLISH properly");
17}
18
19package main;
20{
21 my $foo = Foo->new;
22}
23$expected_igd = 1;
24# Test::Builder checks for a valid plan at END time, which is before global
25# destruction, so need to test that in a subprocess
26unless (fork) {
27 our $foo = Foo->new;
28 exit;
29}
30wait;
31# but stuff that happens in a subprocess doesn't update Test::Builder's state
32# in this process, so do that manually here
33my $builder = Test::More->builder;
34$builder->current_test($builder->current_test + 1);