Skip to content

Commit

Permalink
Make testing on emacs 29.1 work
Browse files Browse the repository at this point in the history
1. ert-runner has problems with tramp (recursive load) on emacs
   29.1. Since cask deprecated the `cask exec` command anyway let's drop
   the usage of ert-runner as well. The make file try to mimic the
   ert-runner behavior to some extent to ease development work.
2. Fix new style check errors related to quotes in doc strings.
  • Loading branch information
dajva committed Dec 2, 2023
1 parent 3df125d commit 8e2347d
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
1 change: 0 additions & 1 deletion Cask
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

(development
(depends-on "cl-lib" "0.5")
(depends-on "ert-runner")
(depends-on "find-file-in-project")
(depends-on "flycheck")
(depends-on "package-lint")
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EMACS_VERSION=28-2
EMACS_VERSION=29-1
DOCKER_IMAGE=rg.el-test-emacs-$(EMACS_VERSION)

ifdef USE_DOCKER
Expand All @@ -20,6 +20,12 @@ OBJECTS = $(SOURCES:.el=.elc)
STYLE_CHECK= -L test -L . -l test/style-check.el
DISABLE_DEFALIAS_CHECK= --eval "(defun package-lint--check-defalias (prefix def))"

# This setup testing similar to ert-runner for legacy reasons.
# All files under test/ that matches the source files.
TEST_FILES = $(filter $(patsubst %,test/%-test.el, $(SOURCES)), $(wildcard test/*.el))
# Load test-helper.el first, then all test files.
LOAD_TEST_FILES = -L test -l test-helper $(patsubst %,-l %,$(TEST_FILES:test/%.el=%))

SPHINX-BUILD = sphinx-build
DOC_DIR = docs
ORG_DOCS= $(wildcard $(DOC_DIR)/*.org)
Expand Down Expand Up @@ -82,13 +88,13 @@ package-lint:
cask emacs -batch -Q $(STYLE_CHECK) $(DISABLE_DEFALIAS_CHECK) -f run-package-lint-and-exit rg.el

unit-test:
cask exec ert-runner --pattern rg-unit
cask emacs --batch -l ert $(LOAD_TEST_FILES) --eval="(ert-run-tests-batch \"rg-unit\")"

integration-test:
cask exec ert-runner --pattern rg-integration
cask emacs --batch -l ert $(LOAD_TEST_FILES) --eval="(ert-run-tests-batch \"rg-integration\")"

ert-test:
cask exec ert-runner --quiet
cask emacs --batch -l ert $(LOAD_TEST_FILES) -f ert-run-tests-batch

deps:
cask install
Expand Down
5 changes: 3 additions & 2 deletions docs/contribute.org
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ repository]]. If you find a bug, please report it in the [[https://github.com/da
:CUSTOM_ID: tests
:END:
[[https://cask.readthedocs.io/][Cask]] is used for testing. The tests are written using the Emacs
built in ERT framework and executed with [[https://github.com/rejeep/ert-runner.el][ert runner]]. There are also
compilation tests, style check, package verification etc.
built in ERT framework and follows the conventions of [[https://github.com/rejeep/ert-runner.el][ert runner]]
although ert_runner is no longer used. There are also compilation
tests, style check, package verification etc.
*** Setup
:PROPERTIES:
:CUSTOM_ID: tests_setup
Expand Down
4 changes: 2 additions & 2 deletions rg-header.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
;; Faces
(defface rg-toggle-on-face
'((t :inherit rg-file-tag-face))
"face for toggle 'on' text in header."
"face for toggle \"on\" text in header."
:group 'rg-face)

(defface rg-toggle-off-face
'((t :inherit rg-error-face))
"face for toggle 'off' text in header."
"face for toggle \"off\" text in header."
:group 'rg-face)

(defface rg-literal-face
Expand Down
18 changes: 9 additions & 9 deletions rg.el
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

(defcustom rg-custom-type-aliases
'()
"A list of file type aliases that are added to the 'rg' built in aliases.
"A list of file type aliases that are added to the ripgrep built in aliases.
Each list element may be a (string . string) cons containing the name of the
type alias and the file patterns, or a lambda returning a similar cons cell.
A lambda should return nil if it currently has no type aliases to contribute."
Expand All @@ -86,7 +86,7 @@ list is not significant."
:group 'rg)

(defcustom rg-executable (executable-find "rg")
"'rg' executable."
"Ripgrep executable."
:type 'string
:group 'rg)

Expand Down Expand Up @@ -154,7 +154,7 @@ line flags to use.")

;; Internal vars and structs
(defvar rg-builtin-type-aliases nil
"Cache for 'rg --type-list'.")
"Cache for \"rg --type-list\".")

(defvar rg-initial-toggle-flags nil
"List of command line flags set by default by `rg-define-toggle' macro.")
Expand All @@ -177,7 +177,7 @@ line flags to use.")
'(("all" . "all defined type aliases") ; rg --type=all
("everything" . "*")) ; rg without '--type' arg
"Internal type aliases for special purposes.
These are not produced by 'rg --type-list' but we need them anyway.")
These are not produced by \"rg --type-list\" but we need them anyway.")

(defvar rg-global-map
(let ((map (make-sparse-keymap)))
Expand Down Expand Up @@ -228,7 +228,7 @@ These are not produced by 'rg --type-list' but we need them anyway.")
(default-value 'rg-executable))))

(defun rg-executable ()
"Return the 'rg' executable.
"Return the \"rg\" executable.
Raises an error if it can not be found."
(let ((executable (rg-find-executable)))
(if executable
Expand All @@ -251,7 +251,7 @@ NAME-OF-MODE is needed to pass this function to `compilation-start'."
(format "*%s*" (rg--buffer-name))))

(defun rg-build-type-add-args ()
"Build a list of --type-add: 'foo:*.foo' flags.
"Build a list of --type-add: \"foo:*.foo\" flags.
Do this for each type in `rg-custom-type-aliases'."
(mapcar
(lambda (typedef)
Expand Down Expand Up @@ -545,11 +545,11 @@ reports."
(defmacro rg-define-toggle (flag &optional key default)
"Define a command line flag that can be toggled from the rg result buffer.
This will create a function with prefix 'rg-custom-toggle-flag-'
This will create a function with prefix \"rg-custom-toggle-flag-\"
concatenated with the FLAG name, stripped of any leading dashes. Flag
must be a form that will be evaluated to a string at macro expansion
time. For instance, if FLAG is '--invert-match' the function name
will be 'rg-custom-toggle-flag-invert-match. If the flag contains a
time. For instance, if FLAG is \"--invert-match\" the function name
will be `rg-custom-toggle-flag-invert-match'. If the flag contains a
value that will be excluded from the function name.
Optional KEY is a key binding that is added to `rg-mode-map'. If the
Expand Down

0 comments on commit 8e2347d

Please sign in to comment.