miyagawa / test-synopsis

Test your code in SYNOPSIS
10 stars 8 forks source link

Doesn't like one-liners in SYNOPSIS #13

Open oalders opened 9 years ago

oalders commented 9 years ago

I'm getting test failures because of this line https://metacpan.org/source/OALDERS/Module-Version-Loaded-0.000003/lib/Module/Version/Loaded.pm#L84

t/release-synopsis.t ...... Bareword found where operator expected at lib/Module/Version/Loaded.pm line 90, near ""store_versioned_modules('test-more.txt')"
perl"
    (Missing operator before perl?)
Bareword found where operator expected at lib/Module/Version/Loaded.pm line 91, near ""store_versioned_modules('app-prove.txt')"
perl"
    (Missing operator before perl?)
t/release-synopsis.t ...... 1/1
#   Failed test 'lib/Module/Version/Loaded.pm'
#   at /Users/olaf/perl5/lib/perl5/Test/Synopsis.pm line 24.
# Can't modify subtraction (-) in scalar assignment at lib/Module/Version/Loaded.pm line 89, near "MTest::More -e "
# syntax error at lib/Module/Version/Loaded.pm line 89, near "MTest::More -e "
# Looks like you failed 1 test of 1.
t/release-synopsis.t ...... Dubious, test returned 1 (wstat 256, 0x100)

Not sure if this is to be expected, but I thought it was worth mentioning.

zoffixznet commented 9 years ago

Thanks for reporting.

Yes, it's trying to execute that as Perl code.

Once we can teach the module to treat multiple SYNOPSIS chunks separately (Issue #12) we could maybe figure out some way to either skip portions of SYNOPSIS or even teach it to check one-liner code.

Currently, the only thing you could use to make it not fail is to use the skip feature. However, it'll also skip non-one-liner section too.

=for test_synopsis BEGIN { die "SKIP: skip this\n"; }

I'm leaving this open and will figure out a solution once Issue #12 is fixed.

Thanks for reporting.