emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Bind calendar-debug-sexp to non-nil when running tests (was: pro


From: Ihor Radchenko
Subject: [PATCH] Bind calendar-debug-sexp to non-nil when running tests (was: problem with diary sexps)
Date: Wed, 19 Oct 2022 02:30:54 +0000

Max Nikulin <manikulin@gmail.com> writes:

>> More accurate error can be found after setting calendar-debug-sexp to t.
>> I got the following backtrace clearly indicating lexical scope issue:
>> 
>> Debugger entered--Lisp error: (void-variable entry)
>>    (diary-float t 2 1)
>>    (let ((entry "") (date '(4 5 2022))) (diary-float t 2 1))
>>    (eval (let ((entry "") (date '(4 5 2022))) (diary-float t 2 1)) t)
>
> It looks like the source of the problem with unit tests that I faced 
> yesterday trying to look closer at the bug with daylight saving time in 
> agenda.

I guess we can permanently bind calendar-debug-sexp to non-nil in tests.
It should help if we encounter diary-related issues in future.

WDYT?

>From e86bbe12b79f9958fcd5ccf1586e9d9c829ee8c2 Mon Sep 17 00:00:00 2001
Message-Id: 
<e86bbe12b79f9958fcd5ccf1586e9d9c829ee8c2.1666146565.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 19 Oct 2022 10:28:40 +0800
Subject: [PATCH] testing: Provide more debug info for diary sexps

* testing/org-test.el (org-test-run-batch-tests):
(org-test-run-all-tests): Bind `calendar-debug-sexp' to non-nil when
running tests.

See https://orgmode.org/list/t2hpe9$119m$1@ciao.gmane.io
---
 testing/org-test.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index 9f7bab9ea..65d157bca 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -457,7 +457,9 @@ (defun org-test-run-batch-tests (&optional 
org-test-selector)
   (let ((org-id-track-globally t)
        (org-test-selector
         (if org-test-selector org-test-selector "\\(org\\|ob\\)"))
-       org-confirm-babel-evaluate org-startup-folded vc-handled-backends)
+       org-confirm-babel-evaluate org-startup-folded vc-handled-backends
+        ;; Catch errors in diary sexps better.
+        (calendar-debug-sexp t))
     (org-test-touch-all-examples)
     (org-test-update-id-locations)
     (org-test-load)
@@ -471,7 +473,9 @@ (defun org-test-run-all-tests ()
   (org-test-touch-all-examples)
   (org-test-update-id-locations)
   (org-test-load)
-  (ert "\\(org\\|ob\\)")
+  (let (;; Catch errors in diary sexps better.
+        (calendar-debug-sexp t))
+    (ert "\\(org\\|ob\\)"))
   (org-test-kill-all-examples))
 
 (defmacro org-test-at-time (time &rest body)
-- 
2.35.1


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]