9c7385017750417105161d20eb07a232dccfdfb4
[p5sagit/Try-Tiny.git] / t / global_destruction_load.t
1 use strict;
2 use warnings;
3 use Test::More;
4
5 BEGIN {
6     plan skip_all => 'Capture::Tiny 0.12 required'
7         unless eval { require Capture::Tiny; Capture::Tiny->VERSION(0.12); 1 };
8     plan tests => 3;
9     Capture::Tiny->import(qw(capture_stderr));
10 }
11
12 for my $func (qw(try catch finally)) {
13     is capture_stderr {
14         system $^X, qw(-It/lib -we),
15             qq{sub DESTROY { require TryUser; TryUser->test_$func }} .
16              q{our $o; $o = bless []};
17     }, '', "$func gets installed when loading Try::Tiny during global destruction";
18 }