unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: thunk2@arcor.de (Thomas Plass)
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 34315@debbugs.gnu.org, Jan Tatarik <jan.tatarik@gmail.com>
Subject: bug#34315: [PATCH] icalendar.el: DURATION fix + more robust timezone handling
Date: Thu, 1 Oct 2020 16:38:51 +0300	[thread overview]
Message-ID: <24437.56299.111042.412318@AGAME7.local> (raw)
In-Reply-To: Your message of Thursday, October 1 2020 03:45:59 (ID: <874knewwfc.fsf@gnus.org>).

Lars Ingebrigtsen wrote at 03:45 on October 1, 2020:
: 
: However, the code makes two tests fail:

Like with the previous patch, I hoped to get away with offloading the
testing part to the maintainer... But the failures prompted me to get
familiar with the test setup for the two culprits.

: 2 unexpected results:
:    FAILED  icalendar--convert-tz-offset
:    FAILED  icalendar--parse-vtimezone

My latest patch requires some test definitions to be modified as well
as existing commented out code to be commented in.

Background: In light of the way an abandonment of daylight saving time
is expressed in VTIMEZONE, my patch will always make sure that - when
no recurrence rules RRULE are specified - the (most recent) UTC offset
of the most recent DAYLIGHT or STANDARD is returned.  This offset is
what counts, IMHO.  Computing and using a TZ spec - even a default one
- seems inappropriate for theses cases.

: In addition, the test cases included aren't actually used?

Implicitly, they are when my patch to icalendar-tests.el (below, not a
--git, sorry) is applied.  The raw ICS data seem rather large for
incorporation into the Lisp code.

But I'd rather let Ulf have the final say about the patches and how
the data is to be tested.


----------------------------------------------------------------------
diff -Naur icalendar-tests.el.bce7de769e0c024b26729c45c2c27c7f3749c499 icalendar-tests.el
--- icalendar-tests.el.bce7de769e0c024b26729c45c2c27c7f3749c499	2020-10-01 12:59:40.051753100 +0200
+++ icalendar-tests.el	2020-10-01 14:04:42.106937900 +0200
@@ -248,7 +248,7 @@
     (setq result (icalendar--parse-vtimezone vtimezone))
     (should (string= "Kolkata, Chennai, Mumbai, New Delhi" (car result)))
     (message (cdr result))
-    (should (string= "STD-05:30DST-05:30,M1.1.1/00:00:00,M1.1.1/00:00:00"
+    (should (string= "STD-05:30"
                      (cdr result)))
 
     ;; FIXME: add testcase that covers changes for fix of bug#34315
@@ -557,28 +557,29 @@
                             (RRULE nil "FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU"))
                           t)))
 
-          ;; testcase: dtstart is mandatory
-          (should (null (icalendar--convert-tz-offset
+          ;; testcase: dtstart is mandatory but if not set return at least the offset
+          (should (equal '("DST-02:00")
+                         (icalendar--convert-tz-offset
                           '((TZOFFSETFROM nil "+0100")
                             (TZOFFSETTO nil "+0200")
                             (RRULE nil "FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU"))
                           t)))
 
-          ;; FIXME: rrule and rdate are NOT mandatory!  Must fix code
-          ;; before activating these testcases
-          ;; ;; testcase: no rrule and no rdate => no result
-          ;; (should (null (icalendar--convert-tz-offset
-          ;;                 '((TZOFFSETFROM nil "+0100")
-          ;;                   (TZOFFSETTO nil "+0200")
-          ;;                   (DTSTART nil "19700329T020000"))
-          ;;                 t)))
-          ;; ;; testcase: no rrule with rdate => no result
-          ;; (should (null (icalendar--convert-tz-offset
-          ;;                 '((TZOFFSETFROM nil "+0100")
-          ;;                   (TZOFFSETTO nil "+0200")
-          ;;                   (DTSTART nil "18840101T000000")
-          ;;                   (RDATE nil "18840101T000000"))
-          ;;                 t)))
+          ;; rrule and rdate are NOT mandatory: return the offset and a placeholder
+          (should (equal '("DST-02:00" . "19700329T020000")
+                         (icalendar--convert-tz-offset
+                          '((TZOFFSETFROM nil "+0100")
+                            (TZOFFSETTO nil "+0200")
+                            (DTSTART nil "19700329T020000"))
+                          t)))
+          ;; ;; testcase: no rrule with rdate => return offset and a default TZ spec
+          (should (equal '("DST-02:00" . "M1.1.1/00:00:00")
+                         (icalendar--convert-tz-offset
+                          '((TZOFFSETFROM nil "+0100")
+                            (TZOFFSETTO nil "+0200")
+                            (DTSTART nil "18840101T000000")
+                            (RDATE nil "18840101T000000"))
+                          t)))
           )
       ;; restore time-zone even if something went terribly wrong
       (setenv "TZ" tz))))





  parent reply	other threads:[~2020-10-01 13:38 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 11:48 bug#34315: [PATCH] icalendar.el: DURATION fix + more robust timezone handling Thomas Plass
2019-02-12 18:57 ` Ulf Jasper
2019-02-15 17:17   ` Ulf Jasper
2019-02-18  9:36     ` Thomas Plass
2019-02-18 15:59       ` Eli Zaretskii
2019-02-18 19:15         ` Thomas Plass
2019-02-18 19:30           ` Eli Zaretskii
2019-02-18 20:03             ` Thomas Plass
2019-02-18 20:16               ` Eli Zaretskii
2020-08-10 11:48     ` Lars Ingebrigtsen
2020-08-10 16:08       ` Ulf Jasper
2020-08-10 16:45         ` Eli Zaretskii
2020-08-10 17:04           ` Thomas Plass
2020-08-11 11:01             ` Lars Ingebrigtsen
2020-08-11 15:14               ` Ulf Jasper
2020-08-11 15:19                 ` Lars Ingebrigtsen
2020-08-11 15:45                   ` Ulf Jasper
2020-08-12 13:08                 ` Thomas Plass
2020-08-12 13:12                   ` Lars Ingebrigtsen
2020-08-12 13:30                     ` Thomas Plass
2020-08-12 15:06                       ` Ulf Jasper
2020-09-02 18:05                         ` Ulf Jasper
2020-09-03  8:38                           ` Thomas Plass
2020-09-03 14:28                             ` Ulf Jasper
2020-09-12  8:01                               ` Thomas Plass
2020-09-12  8:11                                 ` Eli Zaretskii
2020-09-13  4:07                                 ` Richard Stallman
2020-09-29 10:05                               ` Thomas Plass
2020-10-01  1:45                                 ` Lars Ingebrigtsen
2020-10-01  1:50                                   ` Lars Ingebrigtsen
2020-10-01 13:38                                   ` Thomas Plass [this message]
2020-10-01 16:19                                     ` Ulf Jasper
2020-10-01 16:22                                       ` Lars Ingebrigtsen
2020-10-01 16:54                                         ` Ulf Jasper
2020-10-01 16:59                                           ` Lars Ingebrigtsen
2020-10-01 18:40                                             ` Ulf Jasper
2020-10-01 18:47                                               ` Lars Ingebrigtsen
2020-10-01 19:00                                                 ` Ulf Jasper
2020-10-01 18:49                                           ` Thomas Plass
2020-10-01 18:53                                             ` Thomas Plass
2020-10-01 19:14                                             ` Ulf Jasper
2020-10-10 20:06                                               ` Lars Ingebrigtsen
2020-10-22 15:50                                                 ` Ulf Jasper
2021-05-11 14:10                                                   ` Lars Ingebrigtsen
2021-07-29 14:55                                                     ` Ulf Jasper
2021-07-30 11:37                                                       ` Lars Ingebrigtsen
2023-10-01  2:12                                                 ` Stefan Kangas
2023-10-12 14:49                                                   ` Ulf Jasper
2023-10-15 14:28                                                     ` Stefan Kangas
2023-10-19 14:11                                                       ` Ulf Jasper
2023-12-24 14:02                                                         ` Stefan Kangas

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=24437.56299.111042.412318@AGAME7.local \
    --to=thunk2@arcor.de \
    --cc=34315@debbugs.gnu.org \
    --cc=jan.tatarik@gmail.com \
    --cc=larsi@gnus.org \
    /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.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).