branch: externals/hyperbole
commit f62a6463ebbd6790f229a03b62cb2c9c49e946e5
Author: Mats Lidell <[email protected]>
Commit: Mats Lidell <[email protected]>
Tests for org-links outside of org-mode
---
ChangeLog | 6 ++++++
test/hsys-org-tests.el | 27 ++++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 0a2d98c4fd..dda1c64dba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-08 Mats Lidell <[email protected]>
+
+* test/hsys-org-tests.el (hsys-org--org-outside-org-mode-tmp-buffer)
+ (hsys-org--org-outside-org-mode-tmp-file): Tests for org-links outside
+ of org-mode.
+
2024-04-07 Bob Weiner <[email protected]>
* hyrolo.el (hyrolo-consult-grep-paths): Fix handling of zero 'max-matches'
diff --git a/test/hsys-org-tests.el b/test/hsys-org-tests.el
index 9c8a22b3e8..94c7734ef8 100644
--- a/test/hsys-org-tests.el
+++ b/test/hsys-org-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <[email protected]>
;;
;; Orig-Date: 23-Apr-21 at 20:55:00
-;; Last-Mod: 12-Mar-24 at 23:04:29 by Mats Lidell
+;; Last-Mod: 8-Apr-24 at 16:41:14 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -128,6 +128,31 @@
(font-lock-ensure)
(should (hsys-org-face-at-p 'org-target))))
+(ert-deftest hsys-org--org-outside-org-mode-tmp-buffer ()
+ "Org links in a temp buffer should work.
+This is independent of the setting of `hsys-org-enable-smart-keys'."
+ (let ((hsys-org-enable-smart-keys nil)
+ (browse-url-browser-function nil)) ;; Don't open browser on failure
+ (with-temp-buffer
+ (insert "[[file:/tmp/abc][file]]\n")
+ (goto-char 6)
+ (mocklet (((org-open-at-point-global) => t))
+ (action-key)))))
+
+(ert-deftest hsys-org--org-outside-org-mode-tmp-file ()
+ "Org links in a non `org-mode' file should work.
+This is independent of the setting of `hsys-org-enable-smart-keys'."
+ (let ((file (make-temp-file "hypb" nil ".txt" "[[file:/tmp/abc][file]]\n"))
+ (hsys-org-enable-smart-keys nil)
+ (browse-url-browser-function nil)) ;; Don't open browser on failure
+ (unwind-protect
+ (progn
+ (find-file file)
+ (goto-char 6)
+ (mocklet (((org-open-at-point-global) => t))
+ (action-key)))
+ (hy-delete-file-and-buffer file))))
+
(provide 'hsys-org-tests)
;; This file can't be byte-compiled without the `el-mock' package