Running make test on master using Emacs master compiled with native-comp
support throws error:

decode-time((22352 22528) nil nil)
  time-to-days((22352 22528))
  org-time-stamp-to-now("2016-06-03 Fri")
  org-deadline-close-p("2016-06-03 Fri" 0)
  apply(org-deadline-close-p ("2016-06-03 Fri" 0))

As discussed in Emacs bug#48133, this is because of outdated cl-letf
statement in org-test. The attached patch is fixing the problem.

Best,
Ihor

>From f973eb6cf635ccce86b865001d0bca5fba29c898 Mon Sep 17 00:00:00 2001
Message-Id: <f973eb6cf635ccce86b865001d0bca5fba29c898.1619944483.git.yanta...@gmail.com>
From: Ihor Radchenko <yanta...@gmail.com>
Date: Sun, 2 May 2021 16:29:02 +0800
Subject: [PATCH] org-test: Fix wrong-numbre-of-arguments error on
 master+native-comp

* testing/org-test.el (org-test-at-time): Use correct number of
arguments in 'decode-time cl-letf binding. `decode-time' accepts up to
3 arguments on master.

The wrong-numbre-of-arguments error is raised on Emacs master
configured with native-comp support when running make test on Org mode
master.  Native-comp modifies function calls with optional arguments
in the way that omitted arguments are still provided as `nil'.  For
example, `decode-time' called as (decode-time time) in lisp source may
be compiled into (decode-time time nil nil) call by native-compiler.
If redefined `decode-time' does not accept 3 arguments, it result in
error.

See Emacs bug#48133.
---
 testing/org-test.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testing/org-test.el b/testing/org-test.el
index ade212440..30adb977e 100644
--- a/testing/org-test.el
+++ b/testing/org-test.el
@@ -466,8 +466,8 @@ (defmacro org-test-at-time (time &rest body)
 	       (apply ,(symbol-function 'current-time-zone)
 		      (or time ,at) args)))
 	    ((symbol-function 'decode-time)
-	     (lambda (&optional time) (funcall ,(symbol-function 'decode-time)
-					       (or time ,at))))
+	     (lambda (&optional time zone form) (funcall ,(symbol-function 'decode-time)
+					            (or time ,at) zone form)))
 	    ((symbol-function 'encode-time)
 	     (lambda (time &rest args)
 	       (apply ,(symbol-function 'encode-time) (or time ,at) args)))
-- 
2.26.3

Reply via email to