1 BEGIN { our @warnings; $SIG{__WARN__} = sub { push(@warnings, $_[0]); } }
3 use Devel::BeginLift 'foo';
9 sub foo { warn "foo: $_[0]\n"; $int++; 4; }
11 sub bar { warn "bar: $_[0]\n"; $int; }
24 use Test::More 'no_plan';
26 is(shift(@warnings), "foo: foo\n", "compile-time foo call first");
27 is(shift(@warnings), "yep\n", "manual warning");
28 is(shift(@warnings), "4\n", "const return from compile-time foo");
29 is(shift(@warnings), "bar: bar\n", "bar called at run-time");
30 is(shift(@warnings), "2\n", "\$int was incremented");
31 is(shift(@warnings), "foo: \n", "run-time foo after BeginLift disabled");
32 ok(!@warnings, "no more warnings");