B-Hooks-AtRuntime
view release on metacpan or search on metacpan
is_deeply \@Record, [2,4], "at_runtime doesn't confuse line numbering";
if (B::Hooks::AtRuntime::USE_FILTER) {
evals_nok q{ BEGIN { at_runtime { 1 } } },
qr/^Can't use at_runtime from a string eval/,
"at_runtime in eval'' fails with USE_FILTER";
warning_is {
fakerequire "eol", q{
BEGIN { at_runtime { 1 } } 1;
1;
};
} "Extra text '1;' after call to lex_stuff",
"at_runtime not at EOL warns";
warnings_are {
fakerequire "eolcomment", q{
BEGIN { at_runtime { 1 } } # foobar
1;
};
} [],
"comments and whitespace before EOL ignored";
}
else {
@Record = ();
evals_ok q{
push @Record, 1;
BEGIN { at_runtime { push @Record, 2 } }
push @Record, 3;
}, "at_runtime in eval'' works";
is_deeply \@Record, [1..3], "at_runtime in eval'' runs properly";
@Record = ();
warnings_are { fakerequire "eol", q{
push @Record, 1;
BEGIN { at_runtime { push @Record, 2 } } push @Record, 3;
1;
} } [],
"code before EOL doesn't warn";
is_deeply \@Record, [1..3], "code before EOL runs properly";
@Record = ();
fakerequire "eolline", q{
push @Record, __LINE__;
BEGIN { at_runtime { 1 } } push @Record, __LINE__;
push @Record, __LINE__;
1;
};
is_deeply \@Record, [2..4], "code before EOL sees correct __LINE__";
}
done_testing;
( run in 0.918 second using v1.01-cache-2.11-cpan-98e64b0badf )