[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/adoc-mode 63abada690 074/199: test: adoctest-trans learned
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/adoc-mode 63abada690 074/199: test: adoctest-trans learned setting mark using <> |
Date: |
Sun, 3 Sep 2023 06:59:35 -0400 (EDT) |
branch: elpa/adoc-mode
commit 63abada690f68448de71a9078097f9895e63da0d
Author: Florian Kaufmann <sensorflo@gmail.com>
Commit: Florian Kaufmann <sensorflo@gmail.com>
test: adoctest-trans learned setting mark using <>
---
adoc-mode-test.el | 48 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 12 deletions(-)
diff --git a/adoc-mode-test.el b/adoc-mode-test.el
index 91a31d17d8..b4259323db 100644
--- a/adoc-mode-test.el
+++ b/adoc-mode-test.el
@@ -58,24 +58,44 @@
(kill-buffer buf-name))))
(defun adoctest-trans (original-text expected-text transform)
- (if (string-match "!" original-text)
+ "Calling TRANSFORM on EXPECTED-TEXT, ORIGINAL-TEXT `should' result.
+ORIGINAL-TEXT is put in an temporary buffer and TRANSFORM is
+evaluated using `eval'. The resulting buffer content is compared
+to EXPECTED-TEXT.
+
+ORIGINAL-TEXT optionaly may contain the following special
+charachters. Escaping them is not (yet) supported. They are
+removed before TRANSFORM is evaluated.
+
+! Position of point before TRANSFORM is evaluated
+
+<> Position of mark (<) and point (>) before TRANSFORM is
+ evaluatred"
+ (if (string-match "[!<>]" original-text)
;; original-text has ! markers
- (let ((pos 0)
- (pos-old 0)
- (pos-list)
- (new-original-text ""))
+ (let ((pos 0) ; pos in original-text
+ (pos-old 0) ; pos of the last iteration
+ (pos-in-new-region-start 0)
+ (pos-new-list) ; list of positions in new-original-text
+ (new-original-text "")) ; as original-text, but with < > ! stripped
;; original-text -> new-original-text by removing ! and remembering
their positions
(while (and (< pos (length original-text))
- (setq pos (string-match "!" original-text pos)))
+ (setq pos (string-match "[!<>]" original-text pos)))
(setq new-original-text (concat new-original-text (substring
original-text pos-old pos)))
- (setq pos-list (cons (length new-original-text) pos-list))
+ (cond
+ ((eq (aref original-text pos) ?<)
+ (setq pos-in-new-region-start (length new-original-text)))
+ ((eq (aref original-text pos) ?>)
+ (setq pos-new-list (cons (cons pos-in-new-region-start (length
new-original-text)) pos-new-list)))
+ (t
+ (setq pos-new-list (cons (length new-original-text) pos-new-list))))
(setq pos (1+ pos))
(setq pos-old pos))
(setq new-original-text (concat new-original-text (substring
original-text pos-old pos)))
;; run adoctest-trans-inner for each remembered pos
- (while pos-list
- (adoctest-trans-inner new-original-text expected-text transform (car
pos-list))
- (setq pos-list (cdr pos-list))))
+ (while pos-new-list
+ (adoctest-trans-inner new-original-text expected-text transform (car
pos-new-list))
+ (setq pos-new-list (cdr pos-new-list))))
;; original-text has no ! markers
(adoctest-trans-inner original-text expected-text transform)))
@@ -89,8 +109,12 @@
(delete-region (point-min) (point-max))
(adoc-mode)
(insert original-text)
- (when pos
- (goto-char (1+ pos))) ; buffer pos starts at 1, but string
pos at 0
+ (cond ; 1+: buffer pos starts at 1, but string pos at 0
+ ((consp pos)
+ (goto-char (1+ (car pos)))
+ (set-mark (1+ (cdr pos))))
+ (pos
+ (goto-char (1+ pos))))
;; exercise
(eval transform)
;; verify
- [nongnu] elpa/adoc-mode 6dc82593f0 162/199: Document the mode's history, (continued)
- [nongnu] elpa/adoc-mode 6dc82593f0 162/199: Document the mode's history, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 4415af4a53 036/199: fixed typo in identifier, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode fdc42c818a 044/199: removed TAGS file, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 47fc7143a3 048/199: test, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 30176c0f3c 054/199: added skelleton for generig promote / denote, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 303019657d 060/199: many things with xref and anchor, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 6cb42436d2 067/199: test: running the test is now more smoothly, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 838684c227 068/199: comment improvements, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 950223b614 070/199: reworked highlighting of urls, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode d80b29ebc9 072/199: test: bugfix: point was wronly positioned in adoctest-trans, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 63abada690 074/199: test: adoctest-trans learned setting mark using <>,
ELPA Syncer <=
- [nongnu] elpa/adoc-mode 0a35871ac3 083/199: edited (doc-)comments to make it fit package format guidelines, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2bbd6a36ac 088/199: bumped version to 0.6.2, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode b6d54d9007 097/199: bumped version to 0.6.4, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode b508984663 106/199: id attribute of footnoteref now uses markup-internal-reference-face if it's used as reference opposed to anchor, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode ab42f4909a 107/199: (un)constrained quotes can now spawn more than two lines, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 61974788b4 109/199: small reformatting, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 2bcfcea743 112/199: improved comments, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 9916b51199 113/199: small refactoring in field of the adoc-attribute-list text property, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 9957855384 115/199: bumpded version to 0.6.6, ELPA Syncer, 2023/09/03
- [nongnu] elpa/adoc-mode 414e920433 121/199: Avoid some compilation warnings., ELPA Syncer, 2023/09/03