Skip to content

Commit

Permalink
Merge branch 'master' into rsw
Browse files Browse the repository at this point in the history
  • Loading branch information
rswgnu committed Apr 7, 2024
2 parents a09c747 + c87bb41 commit 5ccde44
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 10 deletions.
19 changes: 19 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
man/hyperbole.texi: Remove "version.texi" file and include here to simplify
doc build recipes.

2024-04-05 Mats Lidell <matsl@gnu.org>

* test/hmouse-drv-tests.el (hbut-defil-verbatim): Add test for reported
issue gh#rswgnu/hyperbole/503.

2024-04-01 Mats Lidell <matsl@gnu.org>

* test/hpath-tests.el (hpath:prepend-shell-directory-test):
* test/demo-tests.el (demo-manifest-test): Replace COPYING with DEMO since
it is not exported in all installations, i.e. MELPA.

2024-04-01 Bob Weiner <rsw@gnu.org>

* hyrolo.el (hyrolo-consult-grep-paths): Add this support function for
Expand All @@ -23,6 +34,14 @@

2024-03-31 Mats Lidell <matsl@gnu.org>

* Makefile (coverage): Make target to use the coverage function from the
command line.

* test/hy-test-coverage.el: New test file for producing test coverage
data. Uses the testcover package.
(hy-test--count-coverage): Count the test splotches.
(hy-test-coverage-file): Run tests and produce coverage date.

* .github/workflows/main.yml (jobs): Add Emacs 29.3 to versions used for
the CI builds.

Expand Down
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Author: Bob Weiner
#
# Orig-Date: 15-Jun-94 at 03:42:38
# Last-Mod: 7-Apr-24 at 10:28:59 by Bob Weiner
# Last-Mod: 7-Apr-24 at 10:40:38 by Bob Weiner
#
# Copyright (C) 1994-2023 Free Software Foundation, Inc.
# See the file HY-COPY for license information.
Expand Down Expand Up @@ -562,3 +562,22 @@ endif

dockerized:
docker run -v $$(pwd):/hyperbole -it silex/emacs:${DOCKER_VERSION} bash -c cd hyperbole && make ${DOCKER_TARGETS}

# Run with coverage. Run tests given by testspec and monitor the
# coverage for the specified file.
#
# Usage:
# make coverage file=<file> testspec=<testspec>

# Specify file to inspect for coverage while running tests given by testspec
COVERAGE_FILE = ${file}
ifeq ($(origin testspec), command line)
COVERAGE_TESTSPEC = ${testspec}
else
COVERAGE_TESTSPEC = t
endif
coverage:
$(EMACS) --quick $(PRELOADS) \
--eval "(load-file \"test/hy-test-dependencies.el\")" \
--eval "(load-file \"test/hy-test-coverage.el\")" \
--eval "(hy-test-coverage-file \"${file}\" \"${COVERAGE_TESTSPEC}\")"
1 change: 1 addition & 0 deletions test/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ hsys-org-tests.el - hsys-org tests
hui-register-tests.el - test for hui-register
hui-select-tests.el - hui-select tests
hui-tests.el - tests for hui.el Hyperbole UI
hy-test-coverage.el - provide test coverage information
hy-test-dependencies.el - Hyperbole test dependencies
hy-test-helpers.el - unit test helpers
hypb-tests.el - tests for hypb.el utility functions
Expand Down
12 changes: 6 additions & 6 deletions test/demo-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
;; Last-Mod: 21-Mar-24 at 10:52:07 by Bob Weiner
;; Last-Mod: 1-Apr-24 at 17:35:46 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -282,14 +282,14 @@
(progn
(find-file (expand-file-name "MANIFEST" hyperb:dir))
(goto-char (point-min))
(forward-line 1)
(should (looking-at "COPYING"))
(forward-line 2)
(should (looking-at "DEMO"))
(action-key)
(should (string= "COPYING" (buffer-name)))
(should (looking-at ".*GNU GENERAL PUBLIC LICENSE")))
(should (string= "DEMO" (buffer-name)))
(should (looking-at "\* GNU Hyperbole Full Demo")))
(progn
(hy-test-helpers:kill-buffer "MANIFEST")
(hy-test-helpers:kill-buffer "COPYING"))))
(hy-test-helpers:kill-buffer "DEMO"))))

;; Email compose
(ert-deftest demo-mail-compose-test ()
Expand Down
14 changes: 13 additions & 1 deletion test/hmouse-drv-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 28-Feb-21 at 22:52:00
;; Last-Mod: 8-Mar-24 at 16:52:52 by Mats Lidell
;; Last-Mod: 5-Apr-24 at 23:05:53 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -149,6 +149,18 @@
(should (looking-at "emacs-version")))
(ibtype:delete 'ibtypes::defil-key)))

(ert-deftest hbut-defil-verbatim ()
"Verify defil to recognize filenames highlighted using org =verbatim= text."
;; gh#rswgnu/hyperbole/503
(defil defil-verbatim "=" "=" ".*" "\\&")
(unwind-protect
(with-temp-buffer
(org-mode)
(insert "=~/test.txt=\n")
(goto-char 4)
(hy-test-helpers:action-key-should-call-hpath:find "~/test.txt"))
(ibtype:delete 'ibtypes::defil-verbatim)))

;; Labels
(ert-deftest hbut-ib-link-to-file-with-label ()
(with-temp-buffer
Expand Down
4 changes: 2 additions & 2 deletions test/hpath-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 28-Feb-21 at 23:26:00
;; Last-Mod: 7-Apr-24 at 10:30:56 by Bob Weiner
;; Last-Mod: 7-Apr-24 at 10:40:03 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
Expand Down Expand Up @@ -210,7 +210,7 @@
(dolist (file '("COPYING" "man/hkey-help.txt" "man/im/demo.png"))
(goto-char (point-min))
(should (search-forward (car (last (split-string file "/"))) nil t))
(backward-char 5)
(backward-char (/ (length file) 2))
(hy-test-helpers:action-key-should-call-hpath:find (expand-file-name file hyperb:dir))))
(kill-buffer shell-buffer))))

Expand Down
57 changes: 57 additions & 0 deletions test/hy-test-coverage.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
;;; hy-test-coverage.el --- support for test coverage -*- lexical-binding: t; -*-
;;
;; Author: Mats Lidell
;;
;; Orig-Date: 21-Mar-24 at 13:22:27
;; Last-Mod: 7-Apr-24 at 10:43:42 by Bob Weiner
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
;; Copyright (C) 2024 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
;;
;; This file is part of GNU Hyperbole.

;;; Commentary:
;;
;; Uses the testcover functionality and runs a specified test
;; suite for a file that is monitored for coverage. See
;; "testcover.el" for how to interpret the "splotches", the color code
;; characters in the monitored filed.
;;
;; See also "../Makefile#coverage:", a make target for running from the
;; command line.

;;; Code:

(require 'hypb-ert)
(require 'testcover)

(defun hy-test--count-coverage ()
"Count coverage splotches."
(cl-count-if
(lambda (x)
(string-prefix-p "testcover-" (symbol-name (overlay-get x 'face))))
(car (overlay-lists))))

(defun hy-test-coverage-file (filename &optional testspec)
"In FILENAME, run TESTSPEC and produce coverage data.
With no TESTSPEC all tests are run."
(interactive "fFilename: \nsTestspec: ")
(unless (file-exists-p filename)
(error "(hy-test-coverage-file): File %s does not exist" filename))
(unless testspec
(setq testspec t))
(let ((buff (find-file filename)))
(testcover-unmark-all buff)
(hypb-ert-require-libraries)
(testcover-start filename)
(bury-buffer)
(ert testspec)
(testcover-mark-all buff)
(message "Number of splotches %d." (hy-test--count-coverage))
(switch-to-buffer buff)
(point-min)))

(provide 'hy-test-coverage)
;;; hy-test-coverage.el ends here

0 comments on commit 5ccde44

Please sign in to comment.