From 6e177aa3d3259440498fab04cb1790e458dffdbe Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 7 Apr 2020 21:30:12 -0700 Subject: Ensure idle timer for ‘recentf-save-list’ only gets created once --- test/oni-core-test.el | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/oni-core-test.el b/test/oni-core-test.el index 0672fb3..eb9886e 100644 --- a/test/oni-core-test.el +++ b/test/oni-core-test.el @@ -59,3 +59,12 @@ (oni-core-move-end-of-dwim) (oni-core-move-end-of-dwim) (should (equal 21 (point))))) + +(ert-deftest oni-core-loading-is-idempotent-recentf-idle-timer () + "Test that loading ‘oni-core’ is idempotent in regards to an idle timer." + ;; We already loaded it with the ‘require’ call above. We load it again so we + ;; can check that the timer set up in it doesn’t appear twice. + (load-library "oni-core") + (let* ((pred (lambda (elt) (eq 'recentf-save-list (aref elt 5)))) + (matches (delete nil (mapcar pred timer-idle-list)))) + (should (eq 1 (length matches))))) -- cgit v1.2.3-54-g00ecf