[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/adoc-mode 6b84d70fe0 051/199: test: reworked adoctest-face
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/adoc-mode 6b84d70fe0 051/199: test: reworked adoctest-faces |
Date: |
Sun, 3 Sep 2023 06:59:33 -0400 (EDT) |
branch: elpa/adoc-mode
commit 6b84d70fe08d5e8ae81b548b9f3fe5fc2d9cb7e4
Author: Florian Kaufmann <sensorflo@gmail.com>
Commit: Florian Kaufmann <sensorflo@gmail.com>
test: reworked adoctest-faces
---
adoc-mode-test.el | 70 +++++++++++++++++++++++++++++++------------------------
1 file changed, 40 insertions(+), 30 deletions(-)
diff --git a/adoc-mode-test.el b/adoc-mode-test.el
index b4eb21fc8d..75e977b5a8 100644
--- a/adoc-mode-test.el
+++ b/adoc-mode-test.el
@@ -2,12 +2,9 @@
;;;
;;; Commentary:
;;
-;; - font-lock-support-mode must be nil
+;; Call adoc-test-run to run the test suite
;;
;;; Todo:
-;; - there shoud not be a need to set font-lock-support-mode to nil. Maybe use
-;; the let form, or find a function which forces font lock to do the
-;; fontification of the whole buffer.
;; - test for font lock multiline property
;; - test for presence of adoc-reserved (we do white-box testing here)
;; - test also with multiple versions of (X)Emacs
@@ -19,33 +16,46 @@
(require 'ert)
(require 'adoc-mode)
+;; todo:
+;; - auto-create different contexts like
+;; - beginning/end of buffer
+;; - beginning/end of paragraph
+;; - side-to-side yes/no with next same construct
(defun adoctest-faces (name &rest args)
- (set-buffer (get-buffer-create (concat "adoctest-" name)))
- (delete-region (point-min) (point-max))
-
- (while args
- (insert (propertize (car args) 'adoctest (cadr args)))
- (setq args (cddr args)))
-
- (adoc-mode)
- (font-lock-fontify-buffer)
- (goto-char (point-min))
- (let ((not-done t))
- (while not-done
- (let* ((tmp (get-text-property (point) 'adoctest))
- (tmp2 (get-text-property (point) 'face)))
- (cond
- ((null tmp)) ; nop
- ((eq tmp 'no-face)
- (should (null tmp2)))
- (t
- (if (and (listp tmp2) (not (listp tmp)))
- (should (and (= 1 (length tmp2)) (equal tmp (car tmp2))))
- (should (equal tmp tmp2)))))
- (if (< (point) (point-max))
- (forward-char 1)
- (setq not-done nil)))))
- (kill-buffer (concat "adoctest-" name)))
+ (let ((not-done t)
+ (font-lock-support-mode)
+ (buf-name (concat "adoctest-" name)))
+ (unwind-protect
+ (progn
+ ;; setup
+ (set-buffer (get-buffer-create buf-name))
+ (delete-region (point-min) (point-max))
+ (while args
+ (insert (propertize (car args) 'adoctest (cadr args)))
+ (setq args (cddr args)))
+
+ ;; exercise
+ (adoc-mode)
+ (font-lock-fontify-buffer)
+
+ ;; verify
+ (goto-char (point-min))
+ (while not-done
+ (let* ((tmp (get-text-property (point) 'adoctest))
+ (tmp2 (get-text-property (point) 'face)))
+ (cond
+ ((null tmp)) ; nop
+ ((eq tmp 'no-face)
+ (should (null tmp2)))
+ (t
+ (if (and (listp tmp2) (not (listp tmp)))
+ (should (and (= 1 (length tmp2)) (equal tmp (car tmp2))))
+ (should (equal tmp tmp2)))))
+ (if (< (point) (point-max))
+ (forward-char 1)
+ (setq not-done nil))))))
+ ;; tear-down
+ (kill-buffer buf-name)))
(ert-deftest adoctest-test-titles-simple ()
(adoctest-faces "titles-simple"
- [nongnu] elpa/adoc-mode 6cb365085b 018/199: removed/abandoned lexxer stuff, (continued)
- [nongnu] elpa/adoc-mode 6cb365085b 018/199: removed/abandoned lexxer stuff, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2a088d1e83 020/199: added meta-face-cleanup, initial version, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode eb20a274e0 024/199: made it easier to run tests, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode de18a17505 031/199: fl keyword for comments now in new-style, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 8349f0e05e 032/199: added better support for attribute lists, no tests written yet, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode c8b39080f8 025/199: added that inline subst can't match across block boundaries, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 3ba0822b91 028/199: bugfix: quotes shall not cross labeled list item boundaries, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2da645a750 040/199: attribute-list can have a local face alist / two faces for target of an inline macro can be specified, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 69e44f37ac 049/199: changed default of adoc-insert-replacement to nil, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode a16699bffe 050/199: test: adapted to new ert, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 6b84d70fe0 051/199: test: reworked adoctest-faces,
ELPA Syncer <=
- [nongnu] elpa/adoc-mode a88d4ea5d5 052/199: bugfix: some regexps did not handle end of buffer correctly, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode f1477f70cc 057/199: comment changes, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 601de95b01 062/199: modified regexp for xref for better find, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode b79c243241 059/199: adoc-re-anchor can now match a given id, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 9753b42821 065/199: bumped version to V0.5.0, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 3501940311 073/199: test: running the test is a bit more smoothly, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 734527e2d4 077/199: added link to markup-faces within customization group, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 569eff13b1 078/199: added lots of templates & easy-menu-entries, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 16fe6044b7 081/199: bumped version to 0.6.0, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 091f46e866 061/199: test: added test for goto-ref-label, ELPA Syncer, 2023/09/03