add irc channel
[p5sagit/Devel-GlobalDestruction-XS.git] / t / 03_minusc.t
CommitLineData
101e5667 1use strict;
2use warnings;
3
4{
5 package Test::Scope::Guard;
6 sub new { my ($class, $code) = @_; bless [$code], $class; }
7 sub DESTROY { my $self = shift; $self->[0]->() }
8}
9
10sub ok ($$) {
11 print "not " if !$_[0];
12 print "ok";
13 print " - $_[1]" if defined $_[1];
14 print "\n";
15 !!$_[0]
16}
17
18BEGIN {
19 require B;
20 B::minus_c();
21
22 print "1..3\n";
23 ok( $^C, "Test properly running under minus-c" );
24}
25
26use Devel::GlobalDestruction::XS;
27
28BEGIN {
29 ok !Devel::GlobalDestruction::XS::in_global_destruction(), "BEGIN is not GD with -c";
30}
31
32our $foo;
33BEGIN {
34 $foo = Test::Scope::Guard->new( sub {
35 ok( Devel::GlobalDestruction::XS::in_global_destruction(), "Final cleanup object destruction properly in GD" ) or do {
36 require POSIX;
37 POSIX::_exit(1);
38 };
39 });
40}