Skip to content

Commit

Permalink
Fix byte-compilation of tests and their execution when byte-compiled;…
Browse files Browse the repository at this point in the history
… errors were caused by `logview--test-with-file' evaluating `extra-customizations' at definition time.
  • Loading branch information
doublep committed Sep 21, 2023
1 parent e323a17 commit 30132d1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/logview.el
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
(:extra-customizations (setf extra-customizations (eval (pop body) t)))
(:buffer-mode (setf buffer-mode (pop body)))))
(dolist (customizable (custom-group-members 'logview nil))
(when (eq (cadr customizable) 'custom-variable)
;; Byte-compiled `let' with double-binding for the same variable behaves differently
;; than non-byte-compiled... Avoid double-bindings to dodge this.
(when (and (eq (cadr customizable) 'custom-variable) (not (assq (car customizable) extra-customizations)))
(push (list (car customizable) (list 'quote (eval (car (get (car customizable) 'standard-value)) t))) erase-customizations)))
`(let (,@erase-customizations
,@extra-customizations
Expand Down Expand Up @@ -78,10 +80,12 @@
,@etc)))


(defun logview--test-view-customizations (&rest views)
`((logview--views '(,@views))
(logview--views-initialized t)
(logview--views-need-saving nil)))
;; This can get called from `logview--test-with-file' at compilation time.
(eval-and-compile
(defun logview--test-view-customizations (&rest views)
`((logview--views '(,@views))
(logview--views-initialized t)
(logview--views-need-saving nil))))


(ert-deftest logview-test-log4j-standard-1 ()
Expand Down

0 comments on commit 30132d1

Please sign in to comment.