Skip to content

Commit d7be1a7

Browse files
committed
Rebased on rsw and further improvements
1 parent e0b62aa commit d7be1a7

2 files changed

Lines changed: 32 additions & 36 deletions

File tree

ChangeLog

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
2026-02-01 Mats Lidell <matsl@gnu.org>
1+
2026-02-02 Mats Lidell <matsl@gnu.org>
22

33
* test/hywiki-tests.el (hywiki-tests--word-at): Require wikiword to
44
exist. Use the wikiword range for verifying the highlighting. Avoids
55
differences in how wikiwords are found and lets hywiki-word-at decide.
6-
(hywiki-tests--run-test-case): Do not erase-buffer. Some test cases
7-
depend on preparing the buffer before this is called. Use ert-info for
8-
better feedback when failing.
9-
(hywiki-tests--wikiword-step-check-verification)
10-
(hywiki-tests--wikiword-step-check-verification-with-surrounding-text):
11-
Create wikipages, required by hywkii-tests--word-at.
12-
(hywiki-tests--wikiword-step-check-verification-with-faces)
13-
(hywiki-tests--face-property-for-wikiword-with-wikipage)
14-
(hywiki-tests--no-face-property-for-no-wikipage)
15-
(hywiki-tests--verify-face-property-when-editing-wikiword)
16-
(hywiki-tests--verify-face-property-when-editing-wikiword-first-char)
17-
(hywiki-tests--references-to-org-link, hywiki-tests--word-face-at-p): : Drop
18-
interactive requirement.
6+
(hywiki-tests--word-face-at-p): Drop interactive requirement.
7+
(hywiki-tests--run-test-case): Don't adjust newpos to buffer
8+
limits. It is set by the test specification.
9+
(hywiki-tests--maybe-highlight-page-names): Erase buffer between tests
10+
and enable test as expected success.
11+
(hywiki-tests--verify-removal-of-delimiter-updates-face): Adjust test
12+
case and remove expected failed.
13+
(hywiki-tests--publish-special-cases): Remove error comments and
14+
enable old failing test.
15+
(hywiki-tests--wikiword-identified-in-emacs-lisp-mode): Mark as
16+
expected failed. There are problems with how the WikiWords are
17+
identified that causes the test to fail.
18+
19+
2026-02-01 Mats Lidell <matsl@gnu.org>
1920

2021
* test/hywiki-tests.el (hywiki-tests--publish-special-cases): Avoid revert query.
2122
(hywiki-tests--save-referent-find-use-menu): Use

test/hywiki-tests.el

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;; Author: Mats Lidell
44
;;
55
;; Orig-Date: 18-May-24 at 23:59:48
6-
;; Last-Mod: 2-Feb-26 at 00:32:30 by Bob Weiner
6+
;; Last-Mod: 2-Feb-26 at 10:36:00 by Mats Lidell
77
;;
88
;; SPDX-License-Identifier: GPL-3.0-or-later
99
;;
@@ -1114,15 +1114,10 @@ WikiWord#Csection-subsection
11141114

11151115
(dolist (v `(("WikiWord WikiWord" . ,(format "%s %s" href href))
11161116
("\"WikiWord WikiWord\"" . ,(format "\"%s %s\"" href href))
1117-
;; ^ Missing a space!?
11181117
("WikiWord Text WikiWord" . ,(format "%s Text %s" href href))
11191118
("\"WikiWord Text WikiWord\"" . ,(format "\"%s Text %s\"" href href))
1120-
;; ^ Missing " Text "
11211119
("WikiWord WikiWord WikiWord" . ,(format "%s %s %s" href href href))
1122-
;; !! TODO FIXME
1123-
;; (cons "\"WikiWord WikiWord WikiWord\"" (format "\"%s %s %s\"" href href href))
1124-
;; ^ Crashes due to (wrong-type-argument integer-or-marker-p nil) caused by buffer-substring-no-properties(nil nil)
1125-
))
1120+
("\"WikiWord WikiWord WikiWord\"" . ,(format "\"%s %s %s\"" href href href))))
11261121
(let ((input (car v))
11271122
(regex-output (cdr v))
11281123
(revert-without-query '(".*")))
@@ -1642,11 +1637,11 @@ comparison with expected overlays stable."
16421637
"Choose what test to perform based on value of `hywiki-tests--with-face-test'."
16431638
(let* ((range (hywiki-word-at :range)))
16441639
(when (hywiki-get-referent (car range))
1645-
(if (and range hywiki-tests--with-face-test)
1646-
(save-excursion
1647-
(goto-char (cadr range))
1648-
(hywiki-highlighted-word-at))
1649-
(car range)))))
1640+
(when (and range hywiki-tests--with-face-test)
1641+
(save-excursion
1642+
(goto-char (round (/ (+ (cadr range) (caddr range)) 2.0)))
1643+
(should (equal range (hywiki-highlighted-word-at :range)))))
1644+
(car range))))
16501645

16511646
(defun hywiki-tests--verify-hywiki-word (expected)
16521647
"Verify that `hywiki-word-at' returns t if a wikiword is EXPECTED.
@@ -1831,6 +1826,7 @@ face is verified during the change."
18311826

18321827
(ert-deftest hywiki-tests--wikiword-identified-in-emacs-lisp-mode ()
18331828
"Verify WikiWord is identified when surrounded by delimiters in `emacs-lisp-mode'."
1829+
:expected-result :failed
18341830
(hywiki-tests--preserve-hywiki-mode
18351831
(emacs-lisp-mode)
18361832
(let* ((hsys-org-enable-smart-keys t)
@@ -1925,15 +1921,15 @@ face is verified during the change."
19251921

19261922
(ert-deftest hywiki-tests--verify-removal-of-delimiter-updates-face ()
19271923
"Verify WikiWord highlight face change when adding/removing a delimiter."
1928-
:expected-result :failed
19291924
(hywiki-tests--preserve-hywiki-mode
1930-
(let ((hywiki-tests--with-face-test t))
1931-
(setq wiki-page (cdr (hywiki-add-page "Hi")))
1932-
(dolist (testcase
1933-
'((("\"Hi#a b c\"") (p3 . "Hi#a b c") (p11) (-1) (p3 . "Hi#a") (p10) ("\"") (p3 . "Hi#a b c"))
1934-
(("(Hi#s n)" . "Hi#s n") (-1) (p3 . "Hi#s") (p8) (")" . "Hi#s n"))))
1935-
(erase-buffer)
1936-
(hywiki-tests--run-test-case testcase)))))
1925+
(let ((page (cdr (hywiki-add-page "Hi"))))
1926+
(unwind-protect
1927+
(dolist (testcase
1928+
'((("\"Hi#a b c\"" . t) (p3 . "Hi#a b c") (p11) (-1) (p3 . "Hi#a") (p10) ("\"" . "Hi#a b c"))
1929+
(("(Hi#s n)" . "Hi#s n") (-1) (p3 . "Hi#s") (p8) (")" . "Hi#s n"))))
1930+
(erase-buffer)
1931+
(hywiki-tests--run-test-case testcase))
1932+
(hy-delete-file-and-buffer page)))))
19371933

19381934
(ert-deftest hywiki-tests--wikiword-yanked-with-extra-words ()
19391935
"Verify that a yanked in WikiWord highlights properly."
@@ -2010,7 +2006,6 @@ face is verified during the change."
20102006
Start and stop point of all highlighted regions in the buffer, as
20112007
computed by `hywiki-tests--hywiki-face-regions', are compared to the
20122008
expected result."
2013-
:expected-result :failed
20142009
(hywiki-tests--preserve-hywiki-mode
20152010
(let* ((wikiword (cdr (hywiki-add-page "WiWo")))
20162011
input
@@ -2022,12 +2017,12 @@ expected result."
20222017
("WiWo text WiWo" . ((1 . 5) (11 . 15)))
20232018
("\"WiWo\"" . ((2 . 6)))
20242019
("\"WiWo text\"" . ((2 . 6)))
2025-
;; Failing tests below.
20262020
("\"WiWo WiWo\"" . ((2 . 6) (7 . 11)))
20272021
("\"WiWo text WiWo\"" . ((2 . 6) (12 . 16)))
20282022
("\"WiWo WiWo WiWo\"" . ((2 . 6) (7 . 11) (12 . 16)))))
20292023
(setq input (car v)
20302024
overlay-regions (cdr v))
2025+
(erase-buffer)
20312026
(hywiki-tests--insert input)
20322027
(hywiki-maybe-highlight-references (point-min) (point-max))
20332028
;; Verify Overlays

0 commit comments

Comments
 (0)