summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2024-08-20 19:46:45 +0200
committerUlrich Müller <ulm@gentoo.org>2024-08-21 08:57:59 +0200
commit91928e05c507bda0aeac5ecc1372e24ac2843e14 (patch)
treef76926c673ad07518936402758d81c40e19dabce /test/ebuild-mode-tests.el
parentFixes for checkdoc (diff)
downloadebuild-mode-91928e05c507bda0aeac5ecc1372e24ac2843e14.tar.gz
ebuild-mode-91928e05c507bda0aeac5ecc1372e24ac2843e14.tar.bz2
ebuild-mode-91928e05c507bda0aeac5ecc1372e24ac2843e14.zip
Optimise font-lock keyword collection
* ebuild-mode.el (ebuild-mode-collect-and-split): Don't copy the element when creating a cons cell is enough. * test/ebuild-mode-tests.el (ebuild-mode-test-collect-and-split): Update. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'test/ebuild-mode-tests.el')
-rw-r--r--test/ebuild-mode-tests.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/test/ebuild-mode-tests.el b/test/ebuild-mode-tests.el
index 1237aae..21987db 100644
--- a/test/ebuild-mode-tests.el
+++ b/test/ebuild-mode-tests.el
@@ -63,15 +63,18 @@
(should-not (get-text-property (match-beginning 0) 'face))))
(ert-deftest ebuild-mode-test-collect-and-split ()
- (let ((alist '(((a b) z) ((c d) z) ((e) z) ((f) z) ((g h) z)
- ((i j) y) ((k) y) ((l m) x) ((n) z) ((o p) y)
- ((q r s t u v) w))))
+ (let* ((alist '(((a b) z) ((c d) z) ((e) z) ((f) z) ((g h) z)
+ ((i j) y x) ((k) y x) ((l)) ((m) z) ((n o) y x) ((p))
+ ((q r s t u v) w)))
+ (alist-copy (copy-tree alist)))
(should (equal (ebuild-mode-collect-and-split alist)
- '(((q r s t u v) w) ((l m) x) ((i j k o p) y)
- ((a b c d e f g h n) z))))
+ '(((q r s t u v) w) ((l p)) ((i j k n o) y x)
+ ((a b c d e f g h m) z))))
(should (equal (ebuild-mode-collect-and-split alist 4)
- '(((q r) w) ((s t u v) w) ((o p) y) ((n) z) ((l m) x)
- ((i j k) y) ((e f g h) z) ((a b c d) z))))))
+ '(((q r) w) ((s t u v) w) ((n o) y x) ((m) z) ((l p))
+ ((i j k) y x) ((e f g h) z) ((a b c d) z))))
+ ;; was it non-destructive?
+ (should (equal alist alist-copy))))
(ert-deftest ebuild-mode-test-update-copyright ()
(let ((ebuild-mode-update-copyright t))