update changelog
[p5sagit/Devel-BeginLift.git] / t / proto.t
CommitLineData
00aef8ff 1BEGIN { our @warnings; $SIG{__WARN__} = sub { push(@warnings, $_[0]); } }
2
3use strict;
4use warnings;
5
6sub foo (&) {
7 $_[0]->();
8 ();
9}
10
11sub bar {
12 my ($name, $val) = @_;
13 no strict 'refs';
14 *{$name} = sub (&) { $_[0]->($val); };
15}
16
17use Devel::BeginLift 'foo';
18
19foo {
20 bar "boom1" => "BOOM 1";
21 bar "boom2" => "BOOM 2";
22};
23
24boom1 { warn "1: $_[0]\n"; };
25
26boom2 { warn "2: $_[0]\n"; };
27
28END {
29 use Test::More 'no_plan';
30 our @warnings;
31 is(shift(@warnings), "1: BOOM 1\n", 'boom1');
32 is(shift(@warnings), "2: BOOM 2\n", 'boom2');
33 ok(!@warnings, 'No more warnings');
34}