emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87y1tcczoh.fsf@localhost> (raw)
In-Reply-To: <t2hpe9$119m$1@ciao.gmane.io>

[-- Attachment #1: Type: text/plain, Size: 718 bytes --]

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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-testing-Provide-more-debug-info-for-diary-sexps.patch --]
[-- Type: text/x-patch, Size: 1610 bytes --]

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


[-- Attachment #3: Type: text/plain, Size: 225 bytes --]



-- 
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	other threads:[~2022-10-19  2:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 15:44 problem with diary sexps Eric S Fraga
2022-04-05 10:28 ` Christian Stuermer
2022-04-05 10:51   ` Eric S Fraga
2022-04-05 11:22   ` Ihor Radchenko
2022-04-05 11:39     ` Eric S Fraga
2022-04-08  2:59       ` Ihor Radchenko
2022-04-08 10:46         ` Eric S Fraga
2022-04-05 16:06     ` Max Nikulin
2022-10-19  2:30       ` Ihor Radchenko [this message]
2022-11-11  3:36         ` [PATCH] Bind calendar-debug-sexp to non-nil when running tests (was: problem with diary sexps) Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y1tcczoh.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).