[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 932fc53767: add tests for hypb 9 0 2 part2 (#
From: |
ELPA Syncer |
Subject: |
[elpa] externals/hyperbole 932fc53767: add tests for hypb 9 0 2 part2 (#567) |
Date: |
Wed, 7 Aug 2024 03:58:11 -0400 (EDT) |
branch: externals/hyperbole
commit 932fc53767fabd4e04e79aef0847c4314ec6a384
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>
add tests for hypb 9 0 2 part2 (#567)
---
ChangeLog | 12 ++++++++++++
test/hproperty-tests.el | 40 ++++++++++++++++++++++++++++++++++++++++
test/hy-test-helpers.el | 4 ++--
test/hyrolo-tests.el | 41 ++++++++++++++++++++++++++++++++++++++++-
test/hywiki-tests.el | 17 ++++++++++++++++-
5 files changed, 110 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2b983bcc38..796ff14e15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-08-06 Mats Lidell <matsl@gnu.org>
+
+* test/hproperty-tests.el: Test file for hproperty.
+ (hproperty-tests--but-add): Add test.
+
+* test/hywiki-tests.el (hywiki-tests--convert-words-to-org-link): Add test.
+
+2024-08-05 Mats Lidell <matsl@gnu.org>
+
+* test/hyrolo-tests.el (hyrolo-test--expand-path-list)
+ (hyrolo-test--at-tags-p): Add tests.
+
2024-07-31 Bob Weiner <rsw@gnu.org>
* hibtypes.el (org-uuid-regexp): Add variable def for when missing in certain
earlier Org
diff --git a/test/hproperty-tests.el b/test/hproperty-tests.el
new file mode 100644
index 0000000000..bc8c04e243
--- /dev/null
+++ b/test/hproperty-tests.el
@@ -0,0 +1,40 @@
+;;; hproperty-tests.el --- one line summary -*-
lexical-binding: t; -*-
+;;
+;; Author: Mats Lidell
+;;
+;; Orig-Date: 6-Aug-24 at 20:32:51
+;; Last-Mod: 6-Aug-24 at 21:59:39 by Mats Lidell
+;;
+;; SPDX-License-Identifier: GPL-3.0-or-later
+;;
+;; Copyright (C) 2021-2022 Free Software Foundation, Inc.
+;; See the "HY-COPY" file for license information.
+;;
+;; This file is part of GNU Hyperbole.
+
+;;; Commentary:
+;;
+
+;;; Code:
+
+(require 'ert)
+(require 'el-mock)
+(require 'hproperty)
+
+(ert-deftest hproperty-tests--but-add ()
+ "Verify `hproperty:but-add'."
+ (let ((hproperty:but-emphasize-flag t))
+ (with-temp-buffer
+ (insert "1234")
+ (should (equal 'highlight (hproperty:but-add (point-min) (point-max)
hproperty:but-face)))
+ (goto-char 3)
+ (should (hproperty:but-p))))
+ (let ((hproperty:but-emphasize-flag nil))
+ (with-temp-buffer
+ (insert "1234")
+ (should-not (hproperty:but-add (point-min) (point-max)
hproperty:but-face))
+ (goto-char 3)
+ (should (hproperty:but-p)))))
+
+(provide 'hproperty-tests)
+;;; hproperty-tests.el ends here
diff --git a/test/hy-test-helpers.el b/test/hy-test-helpers.el
index 489e0bac82..4f36f3c99e 100644
--- a/test/hy-test-helpers.el
+++ b/test/hy-test-helpers.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 30-Jan-21 at 12:00:00
-;; Last-Mod: 21-Feb-24 at 23:47:33 by Mats Lidell
+;; Last-Mod: 6-Aug-24 at 00:09:45 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -23,7 +23,7 @@
(eval-when-compile (require 'cl-lib))
(defun hy-test-helpers:consume-input-events ()
- "Use recusive-edit to consume the events kbd-key generates."
+ "Use `recursive-edit' to consume the events kbd-key generates."
(run-with-timer 0.1 nil (lambda () (exit-recursive-edit)))
(recursive-edit))
diff --git a/test/hyrolo-tests.el b/test/hyrolo-tests.el
index 493f4807a8..1d116b1d49 100644
--- a/test/hyrolo-tests.el
+++ b/test/hyrolo-tests.el
@@ -3,7 +3,7 @@
;; Author: Mats Lidell <matsl@gnu.org>
;;
;; Orig-Date: 19-Jun-21 at 22:42:00
-;; Last-Mod: 16-Jun-24 at 15:46:18 by Mats Lidell
+;; Last-Mod: 5-Aug-24 at 22:16:27 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -1658,6 +1658,45 @@ match
(kill-buffer hyrolo-display-buffer)
(ert-fail "Buffer %s should not have been created"
hyrolo-display-buffer))))
+(ert-deftest hyrolo-test--expand-path-list ()
+ "Verify `hyrolo-expand-path-list'."
+ (should (equal (hyrolo-expand-path-list nil) '("~/.rolo.otl")))
+ (let ((bbdb-file nil))
+ (mocklet (((hpath:expand-list
+ '("/file1")
+
"\\.\\(kotl?\\|org\\|ou?tl\\|md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)$"
+ #'file-readable-p)
+ => (list "/file1")))
+ (should (equal (hyrolo-expand-path-list '("/file1")) '("/file1")))))
+ (let ((bbdb-file nil))
+ (mocklet (((hpath:expand-list
+ '("/file1")
+
"\\.\\(kotl?\\|org\\|ou?tl\\|md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)$"
+ #'file-readable-p)
+ => (list "/file1")))
+ (should (equal (hyrolo-expand-path-list '("/file1")) '("/file1"))))))
+
+(ert-deftest hyrolo-test--at-tags-p ()
+ "Verify `hyrolo-at-tags-p´."
+ (let ((orig-buffer-name (symbol-function 'buffer-name)))
+ (cl-letf (((symbol-function 'buffer-name)
+ (lambda (&optional buffer)
+ (if (string-prefix-p " *temp*" (funcall orig-buffer-name))
+ "*HyRolo*"
+ (funcall orig-buffer-name)))))
+ (with-temp-buffer
+ (should (hyrolo-at-tags-p t)))
+ (with-temp-buffer
+ (insert "* header :tag1:tag2:\n")
+ (goto-char (point-min))
+ (search-forward ":tag1")
+ (should (hyrolo-at-tags-p)))))
+ (with-temp-buffer
+ (org-mode)
+ (mocklet (((hyrolo-get-file-list) => '("file")))
+ (let ((buffer-file-name "file"))
+ (should (hyrolo-at-tags-p t))))))
+
(provide 'hyrolo-tests)
;; This file can't be byte-compiled without the `el-mock' package
diff --git a/test/hywiki-tests.el b/test/hywiki-tests.el
index c4fa52ff2e..1670cdba51 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: 26-Jul-24 at 20:01:49 by Mats Lidell
+;; Last-Mod: 6-Aug-24 at 22:36:47 by Mats Lidell
;;
;; SPDX-License-Identifier: GPL-3.0-or-later
;;
@@ -268,5 +268,20 @@
(mocklet ((buffer-name => "*Other Tags*"))
(should-not (hywiki-at-tags-p)))))
+(ert-deftest hywiki-tests--convert-words-to-org-link ()
+ "Verify `hywiki-convert-words-to-org-links' converts WikiWords to org links."
+ (skip-unless (not noninteractive))
+ (unwind-protect
+ (with-temp-buffer
+ (font-lock-mode 1)
+ (hywiki-mode 1)
+ (insert "WikiWord")
+ (newline nil t)
+ (goto-char 4)
+ (hywiki-convert-words-to-org-links)
+ (should (string= "[[hy:WikiWord]]\n"
+ (buffer-substring-no-properties (point-min)
(point-max)))))
+ (hywiki-mode -1)))
+
(provide 'hywiki-tests)
;;; hywiki-tests.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/hyperbole 932fc53767: add tests for hypb 9 0 2 part2 (#567),
ELPA Syncer <=