Subject: Re: bug#61595: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test failure.

From: lux <[email-masked]>
Date: Sat, 18 Feb 2023 15:38:22 +0800

On Sat, 2023-02-18 at 09:29 +0200, Eli Zaretskii wrote:
> > Cc: Xi Lu <[email-masked]>
> > From: Xi Lu <[email-masked]>
> > Date: Sat, 18 Feb 2023 13:46:07 +0800
> > 
> > ---
> >  test/lisp/emacs-lisp/copyright-tests.el | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/test/lisp/emacs-lisp/copyright-tests.el
> > b/test/lisp/emacs-lisp/copyright-tests.el
> > index abb0913a0d7..040071d90d0 100644
> > --- a/test/lisp/emacs-lisp/copyright-tests.el
> > +++ b/test/lisp/emacs-lisp/copyright-tests.el
> > @@ -59,7 +59,8 @@ test-end-chop
> >                  "\nCopyright 2006, 2007, 2008 Foo Bar\n\n")
> >          (copyright-update)
> >          (buffer-substring (- (point-max) 42) (point-max))))
> > -    "Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")))
> > +    (format "Copyright 2006, 2007, 2008, %s Foo Bar\n\n"
> > +            (format-time-string "%Y")))))
> >  
> >  (ert-deftest test-correct-notice ()
> >    (should (equal
> > @@ -70,7 +71,8 @@ test-correct-notice
> >                     (copyright-query nil))
> >                 (copyright-update))
> >               (buffer-string))
> > -           "Copyright 2021 FSF\nCopyright 2021, 2022 FSF\n")))
> > +           (format "Copyright 2021 FSF\nCopyright 2021, %s FSF\n"
> > +                   (format-time-string "%Y")))))
> 
> What is the failure, and why using format-time-string solves that?
> That test doesn't fail for me.
> 
> Please _always_ accompany patches with rationale and the details of
> the problem necessary to understand the patch and decide whether it
> is
> the right solution for the problem.  Comments in the code explaining
> why it does things that are not self-evident (like uses literal years
> for some and format-time-string for others) is also a welcome habit.
> 
> Also, this patch lacks the commit log message.
> 
> Thanks.

Test failure happens in Emacs 28.3, for test failure logs, see
copyright-tests.log

I reattach the patch file.

Thanks.

From 761287b63f1782b27d9807ee386dedd5e34b74ec Mon Sep 17 00:00:00 2001
From: Xi Lu <[email-masked]>
Date: Sat, 18 Feb 2023 13:28:06 +0800
Subject: [PATCH] 28.3; test/lisp/emacs-lisp/copyright-tests.el: Fix test
 failure.

---
 test/lisp/emacs-lisp/copyright-tests.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/lisp/emacs-lisp/copyright-tests.el b/test/lisp/emacs-lisp/copyright-tests.el
index abb0913a0d7..040071d90d0 100644
--- a/test/lisp/emacs-lisp/copyright-tests.el
+++ b/test/lisp/emacs-lisp/copyright-tests.el
@@ -59,7 +59,8 @@ test-end-chop
                 "\nCopyright 2006, 2007, 2008 Foo Bar\n\n")
         (copyright-update)
         (buffer-substring (- (point-max) 42) (point-max))))
-    "Copyright 2006, 2007, 2008, 2022 Foo Bar\n\n")))
+    (format "Copyright 2006, 2007, 2008, %s Foo Bar\n\n"
+            (format-time-string "%Y")))))
 
 (ert-deftest test-correct-notice ()
   (should (equal
@@ -70,7 +71,8 @@ test-correct-notice
                    (copyright-query nil))
                (copyright-update))
              (buffer-string))
-           "Copyright 2021 FSF\nCopyright 2021, 2022 FSF\n")))
+           (format "Copyright 2021 FSF\nCopyright 2021, %s FSF\n"
+                   (format-time-string "%Y")))))
 
 (provide 'copyright-tests)
 ;;; copyright-tests.el ends here
-- 
2.30.2