-
Notifications
You must be signed in to change notification settings - Fork 12
new branch #850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new branch #850
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,21 @@ | ||
| 2026-02-08 Mats Lidell <[email protected]> | ||
|
|
||
| * test/hywiki-tests.el (hywiki-tests--word-at): Require wikiword to | ||
| exist. Use the wikiword range for verifying the highlighting. Avoids | ||
| differences in how wikiwords are found and lets hywiki-word-at decide. | ||
| (hywiki-tests--word-face-at-p): Drop interactive requirement. | ||
| (hywiki-tests--run-test-case): Don't adjust newpos to buffer | ||
| limits. It is set by the test specification. | ||
| (hywiki-tests--wikiword-identified-in-emacs-lisp-mode): Mark as | ||
| expected failed. There are problems with how the WikiWords are | ||
| identified that causes the test to fail. | ||
| (hywiki-tests--publish-special-cases): Remove error comments and | ||
| enable old failing test. | ||
| (hywiki-tests--verify-removal-of-delimiter-updates-face): Adjust test | ||
| case and remove expected failed. | ||
| (hywiki-tests--maybe-highlight-page-names): Erase buffer between tests | ||
| and enable test as expected success. | ||
|
|
||
| 2026-02-07 Bob Weiner <[email protected]> | ||
|
|
||
| * test/hywiki-tests.el (hywiki-tests--verify-removal-of-delimiter-updates-face): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1114,15 +1114,10 @@ WikiWord#Csection-subsection | |
|
|
||
| (dolist (v `(("WikiWord WikiWord" . ,(format "%s %s" href href)) | ||
| ("\"WikiWord WikiWord\"" . ,(format "\"%s %s\"" href href)) | ||
| ;; ^ Missing a space!? | ||
| ("WikiWord Text WikiWord" . ,(format "%s Text %s" href href)) | ||
| ("\"WikiWord Text WikiWord\"" . ,(format "\"%s Text %s\"" href href)) | ||
| ;; ^ Missing " Text " | ||
| ("WikiWord WikiWord WikiWord" . ,(format "%s %s %s" href href href)) | ||
| ;; !! TODO FIXME | ||
| ;; (cons "\"WikiWord WikiWord WikiWord\"" (format "\"%s %s %s\"" href href href)) | ||
| ;; ^ Crashes due to (wrong-type-argument integer-or-marker-p nil) caused by buffer-substring-no-properties(nil nil) | ||
| )) | ||
| ("\"WikiWord WikiWord WikiWord\"" . ,(format "\"%s %s %s\"" href href href)))) | ||
| (let ((input (car v)) | ||
| (regex-output (cdr v)) | ||
| (revert-without-query '(".*"))) | ||
|
|
@@ -1607,7 +1602,6 @@ See gh#rswgnu/hyperbole/669." | |
|
|
||
| (ert-deftest hywiki-tests--word-face-at-p () | ||
| "Verify `hywiki-word-face-at-p'." | ||
| (skip-unless (not noninteractive)) | ||
| (hywiki-tests--preserve-hywiki-mode | ||
| (hywiki-mode nil) | ||
| (hywiki-tests--insert "WikiWor") | ||
|
|
@@ -1640,12 +1634,14 @@ comparison with expected overlays stable." | |
| "Non-nil to perform face validation of WikiWord.") | ||
|
|
||
| (defun hywiki-tests--word-at () | ||
| "Test if there is a HyWikiWord reference at point with a referent. | ||
| Choose what test to perform based on value of `hywiki-tests--with-face-test'." | ||
| (when (hywiki-referent-exists-p) | ||
| (if hywiki-tests--with-face-test | ||
| (hywiki-highlighted-word-at) | ||
| (hywiki-word-at)))) | ||
| "Choose what test to perform based on value of `hywiki-tests--with-face-test'." | ||
| (let* ((range (hywiki-word-at :range))) | ||
| (when (hywiki-get-referent (car range)) | ||
| (when hywiki-tests--with-face-test | ||
| (save-excursion | ||
| (goto-char (round (/ (+ (cadr range) (caddr range)) 2.0))) | ||
| (should (equal range (hywiki-highlighted-word-at :range))))) | ||
| (car range)))) | ||
|
|
||
| (defun hywiki-tests--verify-hywiki-word (step expected) | ||
| "Verify that `hywiki-word-at' returns t if a wikiword is EXPECTED. | ||
|
|
@@ -1691,30 +1687,29 @@ point when the function is called." | |
| (let ((origin (point))) | ||
| (ert-info ((format "Test case => '%s'" test-case)) | ||
| (dolist (steps test-case) | ||
| (let ((step (car steps)) | ||
| (let ((step (car steps)) | ||
| (vfy (cdr steps))) | ||
| (cond ((stringp step) | ||
| (dolist (ch (string-to-list step)) | ||
| (dolist (ch (string-to-list step)) | ||
| (hywiki-tests--command-execute #'self-insert-command 1 ch)) | ||
| (save-excursion | ||
| (save-excursion | ||
| (goto-char (1- (point))) | ||
| (hywiki-tests--verify-hywiki-word step vfy))) | ||
| ((integerp step) | ||
| (let ((forward (> step 0))) | ||
| (dotimes (_ (abs step)) | ||
| (if forward | ||
| (hywiki-tests--command-execute #'delete-forward-char 1) | ||
| (hywiki-tests--command-execute #'delete-forward-char 1) | ||
| (hywiki-tests--command-execute #'backward-delete-char 1))) | ||
| (hywiki-tests--verify-hywiki-word step vfy))) | ||
| ((and (symbolp step) (string-prefix-p "p" (symbol-name step))) | ||
| (let* ((pos (string-to-number (substring (symbol-name step) 1))) | ||
| (newpos (max (min (+ origin (1- pos)) (point-max)) | ||
| (point-min)))) | ||
| ((and (symbolp step) (string-prefix-p "p" (symbol-name step))) | ||
| (let* ((pos (string-to-number (substring (symbol-name step) 1))) | ||
| (newpos (+ origin (1- pos)))) | ||
| (when (or (> (point-min) newpos) (< (point-max) newpos)) | ||
| (ert-fail (format "New point: '%s' is outside of buffer" newpos))) | ||
| (goto-char newpos)) | ||
| (hywiki-tests--verify-hywiki-word step vfy)) | ||
| (t (ert-fail (format "Unknown step: '%s' in WikiWord verification" step))))))))) | ||
| (hywiki-tests--verify-hywiki-word step vfy)) | ||
| (t (ert-fail (format "Unknown step: '%s' in WikiWord verification" step))))))))) | ||
|
|
||
| (defconst hywiki-tests--wikiword-step-check | ||
| '( | ||
|
|
@@ -1835,6 +1830,7 @@ face is verified during the change." | |
|
|
||
| (ert-deftest hywiki-tests--wikiword-identified-in-emacs-lisp-mode () | ||
| "Verify WikiWord is identified when surrounded by delimiters in `emacs-lisp-mode'." | ||
| :expected-result :failed | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the test case that fails. With hywiki-mode :all and WikiWord page created this in emacs-lisp-mode below There WikiWord is not highlighted but hywiki-word-at says it is a WikiWord. Is that the expected behavior? It seems wrong. It can be reproduced manually. Ideally tests with or without face check should behave the same. |
||
| (hywiki-tests--preserve-hywiki-mode | ||
| (emacs-lisp-mode) | ||
| (let* ((hsys-org-enable-smart-keys t) | ||
|
|
@@ -1930,16 +1926,15 @@ face is verified during the change." | |
| (ert-deftest hywiki-tests--verify-removal-of-delimiter-updates-face () | ||
| "Verify WikiWord highlight face change when adding/removing a delimiter." | ||
| (hywiki-tests--preserve-hywiki-mode | ||
| (let ((hywiki-tests--with-face-test t) | ||
| (hi-page (cdr (hywiki-add-page "Hi")))) | ||
| (let ((page (cdr (hywiki-add-page "Hi")))) | ||
| (unwind-protect | ||
| (dolist (testcase | ||
| '((("\"Hi#a b c\"" . "Hi#a b c") (p3 . "Hi#a b c") | ||
| (p11) (-1) (p3 . "Hi#a") (p10) ("\" ") (p3 . "Hi#a b c")) | ||
| (dolist (testcase | ||
| '((("\"Hi#a b c\"" . t) (p3 . "Hi#a b c") | ||
| (p11) (-1) (p3 . "Hi#a") (p10) ("\"" . "Hi#a b c")) | ||
| (("(Hi#s n)" . "Hi#s n") (-1) (p3 . "Hi#s") (p8) (")" . "Hi#s n")))) | ||
| (erase-buffer) | ||
| (erase-buffer) | ||
| (hywiki-tests--run-test-case testcase)) | ||
| (hy-delete-file-and-buffer hi-page))))) | ||
| (hy-delete-file-and-buffer page))))) | ||
|
|
||
| (ert-deftest hywiki-tests--wikiword-yanked-with-extra-words () | ||
| "Verify that a yanked in WikiWord highlights properly." | ||
|
|
@@ -2016,7 +2011,6 @@ face is verified during the change." | |
| Start and stop point of all highlighted regions in the buffer, as | ||
| computed by `hywiki-tests--hywiki-face-regions', are compared to the | ||
| expected result." | ||
| :expected-result :failed | ||
| (hywiki-tests--preserve-hywiki-mode | ||
| (let* ((wikiword (cdr (hywiki-add-page "WiWo"))) | ||
| input | ||
|
|
@@ -2028,12 +2022,12 @@ expected result." | |
| ("WiWo text WiWo" . ((1 . 5) (11 . 15))) | ||
| ("\"WiWo\"" . ((2 . 6))) | ||
| ("\"WiWo text\"" . ((2 . 6))) | ||
| ;; Failing tests below. | ||
| ("\"WiWo WiWo\"" . ((2 . 6) (7 . 11))) | ||
| ("\"WiWo text WiWo\"" . ((2 . 6) (12 . 16))) | ||
| ("\"WiWo WiWo WiWo\"" . ((2 . 6) (7 . 11) (12 . 16))))) | ||
| (setq input (car v) | ||
| overlay-regions (cdr v)) | ||
| (erase-buffer) | ||
| (hywiki-tests--insert input) | ||
| (hywiki-maybe-highlight-references (point-min) (point-max)) | ||
| ;; Verify Overlays | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we verify that the highlighted range is the same as what is returned by hywiki-word-at. Point is though adjusted to be within the range since hywiki-word-at does accept point to be outside of the range and still finds the wikiword.