From e8601aa8545f47eec00f051b26cfde93d5ab58ed Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Mon, 8 Jun 2026 23:46:49 +0200 Subject: [PATCH 1/4] Replace mock of call-interactively with cl-letf mock * test/hyrolo-tests.el (hyrolo-tests--grep-or-fgrep): Use cl-letf for mocking call-interactively. Functions with optional arguments does not work with el-mock and native compilation. The mock is called with the optional args set to nil causing it to see different number of arguments depending on whether the code is natively compiled or not. --- test/hyrolo-tests.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el index 90defd8a..046866f1 100644 --- a/test/hyrolo-tests.el +++ b/test/hyrolo-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 19-Jun-21 at 22:42:00 -;; Last-Mod: 1-Jun-26 at 00:09:22 by Bob Weiner +;; Last-Mod: 8-Jun-26 at 23:42:26 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -2010,12 +2010,14 @@ match (ert-deftest hyrolo-tests--grep-or-fgrep () "Verify `hyrolo-grep-or-fgrep' calls hyrolo grep or fgrep based on prefix arg. Uses mocks to verify the call path." - (with-mock - (mock (call-interactively 'hyrolo-grep)) - (hyrolo-grep-or-fgrep)) - (with-mock - (mock (call-interactively 'hyrolo-fgrep)) - (hyrolo-grep-or-fgrep '(4)))) + (let ((captured-args nil)) + (cl-letf (((symbol-function 'call-interactively) + (lambda (cmd &optional record-flag keys) + (setq captured-args (list cmd record-flag keys))))) + (hyrolo-grep-or-fgrep) + (should (equal (car captured-args) #'hyrolo-grep)) + (hyrolo-grep-or-fgrep '(4)) + (should (equal (car captured-args) #'hyrolo-fgrep))))) (ert-deftest hyrolo-tests--kill () "Verify `hyrolo-kill' deletes hyrolo items and handles error cases. From ecce0b5fd73f7384814efac567c470a9ae44af0e Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Tue, 9 Jun 2026 00:24:02 +0200 Subject: [PATCH 2/4] Uncomment working test case * test/hywiki-tests.el (hywiki-tests--edit-string-pairs): Uncomment working test case. --- test/hywiki-tests.el | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el index 589382e8..c2b8afb6 100644 --- a/test/hywiki-tests.el +++ b/test/hywiki-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 18-May-24 at 23:59:48 -;; Last-Mod: 12-Apr-26 at 15:11:29 by Bob Weiner +;; Last-Mod: 9-Jun-26 at 16:26:28 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -50,10 +50,7 @@ named WikiReferent with a non-page referent type." (defconst hywiki-tests--edit-string-pairs [ - ;; !! TODO: This test fails - ;; ("\"WikiWord#section with spaces\"" "\"{WikiWord#section} with spaces") ;; shrink highlight to "{WikiWord#section} - - ;; These tests pass + ("\"WikiWord#section with spaces\"" "\"{WikiWord#section} with spaces") ;; shrink highlight to "{WikiWord#section} ("Hi#a cd" "{Hi#ab} cd") ("\"WikiWord#a b c" "\"{WikiWord#a} b") ("Hi" "{Hi}") From 3b974bac690254aa5fc579c1d40ab404785a652b Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Tue, 9 Jun 2026 00:25:04 +0200 Subject: [PATCH 3/4] Remove comment Cleanup: Possibly this once documented that the wrong ibtype was found and that got fixed without removing this comment!? * test/hbut-tests.el (hbut-tests--ibut-at-p-identifies-a-remote-pathname): Remove comment. --- test/hbut-tests.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hbut-tests.el b/test/hbut-tests.el index 018daf3a..e72c5c77 100644 --- a/test/hbut-tests.el +++ b/test/hbut-tests.el @@ -3,7 +3,7 @@ ;; Author: Mats Lidell ;; ;; Orig-Date: 30-may-21 at 09:33:00 -;; Last-Mod: 12-Apr-26 at 15:11:31 by Bob Weiner +;; Last-Mod: 9-Jun-26 at 00:01:32 by Mats Lidell ;; ;; SPDX-License-Identifier: GPL-3.0-or-later ;; @@ -780,7 +780,7 @@ See #10 for the proper way to add an ibutton name. (should (equal (hattr:get (ibut:at-p) 'categ) 'ibtypes::pathname)) (goto-char (- (point-max) 5)) (should (equal (hattr:get (ibut:at-p) 'categ) 'ibtypes::pathname)) - (goto-char 8) ;; ibtypes::mail-address !! + (goto-char 8) (should (equal (hattr:get (ibut:at-p) 'categ) 'ibtypes::pathname)))) (ert-deftest hypb--gbut-act-with-web-link () From b5b621bdaae41be76eb1fda9d6eb076c08f0e66d Mon Sep 17 00:00:00 2001 From: Mats Lidell Date: Tue, 9 Jun 2026 16:19:15 +0200 Subject: [PATCH 4/4] Add ChangeLog --- ChangeLog | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2da74041..0ed71ff2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2026-06-09 Mats Lidell + +* test/hbut-tests.el (hbut-tests--ibut-at-p-identifies-a-remote-pathname): + Remove comment. + +* test/hywiki-tests.el (hywiki-tests--edit-string-pairs): Uncomment + working test case. + +* test/hyrolo-tests.el (hyrolo-tests--grep-or-fgrep): Use cl-letf for + mocking call-interactively. Functions with optional arguments does not + work with el-mock and native compilation. The mock is called with the + optional args set to nil causing it to see different number of + arguments depending on whether the code is natively compiled or not. + 2026-06-07 Bob Weiner * hbut.el (ibut:to-text): Fix missing let of 'name-end' and assign a value.