florence / cover

a code coverage tool for racket
MIT License
38 stars 7 forks source link

Off-by-one red and green highlight in html report #116

Closed SuzanneSoy closed 8 years ago

SuzanneSoy commented 8 years ago

In a rather large file of mine, there is an off-by-one error for the colors in the html file.

repo: https://github.com/jsmaniac/phc.git commit: 7000b80a5df6aed5ee2d63cf5235510ed3c72039 file: graph-lib/graph/graph.lp2.rkt line: 667

cover-off-by-one

To build the project (and the coverage info in docs/coverage):

make build-dep
make

I tried making a smaller example, but it's difficult because the off-by-one error disappeared after I inlined a couple of scribble/lp2 chunks.

Worth noting: the bug was still there after I removed all the scribble text, and left only all the @chunk and @CHUNK.

If I can provide any extra debug information, please tell me how to generate it.

SuzanneSoy commented 8 years ago

I found an off-by-one red highlight in a much simpler file, which doesn't use #lang scribble:

the "e" in "define" is colored in red, but not the rest of the word

#lang racket

;; Don't forget to require this at the template level! Otherwise, Racket will
;; complain that two instances of racket/gui are started.

(module m-browse-syntax typed/racket
  (require/typed macro-debugger/syntax-browser
                 [browse-syntax (→ Syntax Any)]
                 [browse-syntaxes (→ (Listof Syntax) Any)])

  (provide browse-syntax
           browse-syntaxes))

(define (debug-syntax stx)
  (syntax-local-lift-expression #`(browse-syntax #'#,stx)))

(require 'm-browse-syntax)
(provide browse-syntax
         browse-syntaxes
         debug-syntax)

;; Avoid problems with raco test on headless machines (GTK tries to open
;; display :0 otherwise)
(module main racket)
(module test racket)
florence commented 8 years ago

thanks to @rpless I've narrowed this down to a multibyte character issue, specifically an issue with how multibyte characters are counted by the renderer when inside of an ignored submodule. If you remove the character the coloration is correct. Are there any of these characters in your scribble example (i.e. is this the same or a separate bug)?

SuzanneSoy commented 8 years ago

@florence Thanks for looking at this. Yes, there are (many) occurrences of , Δ and other unicode characters in the scribble example, so it's highly likely to be the same bug.

florence commented 8 years ago

Fixed by c9be7019fbf9f22e0c32094c27028de1b014028c