Hi there,
I've been trying out the great new coverage changes made in JRUBY-6106. I have a Sinatra app for which simplecov is now working perfectly, but I've hit an interesting problem when trying the same thing on a Rails app.
I'm building against the current git master
(4e471f489ee6e6aa5d74d64893d709c85a312ee1) with:
When I use the resulting jar to run my Rails app with simplecov enabled, I get exceptions like this:
After a bit of debugging I think I've tracked the problem down to what might be two different issues.
The first issue comes about when calling require on an empty file (or a file consisting of nothing but comments). This seems to cause a null to be added to the coverage data, which blows up when generating results. I can reproduce that with:
For me, that blows up with an exception like the one shown above.
I'm finding the other issue a bit harder to nail down. The ParserConfiguration.coverLine(int i) method takes a line number and marks it off as being covered. But when running my Rails app under simplecov, I see that 'i' isn't always positive--I see numbers ranging from -9 and up, and the negative number causes a RuntimeException when it tries to access an invalid array offset.
I haven't made much headway in figuring out why the parser would report a negative line number--it only seems to happen in my app when parsing .erb files, but I can't reproduce the problem when loading the same .erb templates from the command line. I thought I'd just check if line numbers sometimes being negative was expected before diving in further.
I've attached a patch that sorts things out for my local instance, but realise I'm probably just masking the symptoms. I thought it might help to show the spots I'm talking about, though.
Thanks for all your great work, and please let me know if I can do any debugging from this end.
Cheers,
Mark
|