Skip to content

results lookup against .resultset.json is case sensitive (windows) #8

Description

@ruskotron

Hi, thanks for a great plugin!

I had an issue where SimpleCov is generating .resultset.json with capital letter for drive ("C:") but coverage.el expects a lower-case value ("c:"). The case of all other characters in the file-path match, and I am able to rectify the situation by lower-casing the letter in the .resultset.json file.

I spent some time trying to patch SimpleCov so that it would generate the filenames in the expected format, but then I realised that the problem wasn't with the generated, or expected typecase, but with the means of comparison.

I modified coverage.el as follows. I don't know if you want to add this directly to your code since it may not be desired on other platforms but I provide here in case others are having similar issue.

I'm not very experienced with lisp, so there may be a neater way to do this, but for now rather than performing a straight associative lookup, it will iterate the keys and perform a case-insensitive comparison returning the first that matches.

Best,
Rob

(defun coverage-get-results-for-file (target-path result-path)
  "Return coverage for the file at TARGET-PATH from RESULT-PATH."
  (cl-coerce (cdr
              (car
               (cl-remove-if-not 'identity
                                 (mapcar (lambda (l)

;; === Begin New ===                                           
                                           (seq-find
                                             (lambda (x)
                                               (string-equal
                                                 (downcase target-path)
                                                 (downcase (symbol-name (car x)))))

                                             (cdr (assoc 'coverage l)))
;; === End New ===
;;                                           (assoc-string target-path
;;                                                         (assoc 'coverage l))
                                           )
                                         (coverage-get-json-from-file result-path)))))
             'list))

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions