Closed atoomic closed 5 years ago
PPI parsing is currently ignoring eval blocks: Adding the tests to rewrite.t shows it
q[eval q{ref $foo eq 'ARRAY'}] => q[eval q{is_arrayref($foo)}], q[eval q/ref $foo eq 'ARRAY'/] => q[eval q/is_arrayref($foo)/], q[eval "ref $foo eq 'ARRAY'"] => q[eval "is_arrayref($foo)"],
t/rewrite.t .. 1..11 ok 1 - use Ref::Util::Rewriter; ok 2 - Ref::Util::Rewriter->can(...) ok 3 - ref $foo eq 'ARRAY'; ok 4 - ref($foo) eq 'ARRAY'; ok 5 - ref ($foo) eq 'ARRAY'; ok 6 - ref($foo) or ok 7 - if (ref($foo) eq 'ARRAY') { ok 8 - ref($foo) eq 'ARRAY' or not ok 9 - eval q{ref $foo eq 'ARRAY'} # Failed test 'eval q{ref $foo eq 'ARRAY'}' # at t/rewrite.t line 29. # got: 'eval q{ref $foo eq 'ARRAY'}' # expected: 'eval q{is_arrayref($foo)}' not ok 10 - eval q/ref $foo eq 'ARRAY'/ # Failed test 'eval q/ref $foo eq 'ARRAY'/' # at t/rewrite.t line 29. # got: 'eval q/ref $foo eq 'ARRAY'/' # expected: 'eval q/is_arrayref($foo)/' not ok 11 - eval "ref $foo eq 'ARRAY'" # Failed test 'eval "ref $foo eq 'ARRAY'"' # at t/rewrite.t line 29. # got: 'eval "ref $foo eq 'ARRAY'"' # expected: 'eval "is_arrayref($foo)"' # Looks like you failed 3 tests of 11. Dubious, test returned 3 (wstat 768, 0x300) Failed 3/11 subtests Test Summary Report ------------------- t/rewrite.t (Wstat: 768 Tests: 11 Failed: 3) Failed tests: 9-11 Non-zero exit status: 3 Files=1, Tests=11, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.08 cusr 0.01 csys = 0.11 CPU) Result: FAIL
We could call the main logic recursively on the content of the eval but replacing the Token::Quote::* element does not seem to be trivial.
Fix merged!
PPI parsing is currently ignoring eval blocks: Adding the tests to rewrite.t shows it
We could call the main logic recursively on the content of the eval but replacing the Token::Quote::* element does not seem to be trivial.