After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 743007 - Coverage counters can't handle files without trailing newlines properly
Coverage counters can't handle files without trailing newlines properly
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
1.43.x
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2015-01-16 07:05 UTC by Sam Spilsbury
Modified: 2015-01-17 01:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allocate nLines + 1 (5.34 KB, patch)
2015-01-16 07:05 UTC, Sam Spilsbury
committed Details | Review

Description Sam Spilsbury 2015-01-16 07:05:01 UTC
Created attachment 294643 [details] [review]
Allocate nLines + 1

Amazingly, its been a while until we ran into this issue.

The output from gjs is (gjs:10925): Gjs-WARNING **: JS REPORTED: [resource:///org/gnome/gjs/modules/coverage.js 571]: Error: Executed line 63 which was past the highest-found line.

The problem is that we use 1-indexing for things and allocate an array the size of nLines. This works, so long as there's an empty line which would have never been executed on the end of the script, but a trailing newline is not required for a script to be valid. We need to handle that case.

Some tests also assume that the array produced is nLines length and not nLines + 1, so they need to be adjusted too.
Comment 1 Jasper St. Pierre (not reading bugmail) 2015-01-17 00:48:02 UTC
Review of attachment 294643 [details] [review]:

OK.