summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/regression.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/test/regression.c b/src/test/regression.c
index 957b9c26..130cdbfa 100644
--- a/src/test/regression.c
+++ b/src/test/regression.c
@@ -4963,8 +4963,8 @@ static void test_comma_in_xproperty(void)
icalcomponent_free(c);
}
-void test_icaltime_as_timet(void) {
-
+void test_icaltime_as_timet(void)
+{
ok("icaltime_from_string translates 19020101T000000Z to -2145916800", icaltime_as_timet(icaltime_from_string("19020101T000000Z")) == -2145916800);
ok("icaltime_from_string translates 19290519T000000Z to -1281916800", icaltime_as_timet(icaltime_from_string("19290519T000000Z")) == -1281916800);
ok("icaltime_from_string translates 19561004T000000Z to -417916800", icaltime_as_timet(icaltime_from_string("19561004T000000Z")) == -417916800);
@@ -4986,6 +4986,32 @@ void test_icaltime_as_timet(void) {
#endif
}
+void test_icalcomponent_with_lastmodified(void)
+{
+ /* for https://github.com/libical/libical/issues/585 */
+
+ icalcomponent *comp;
+ struct icaltimetype lm = icaltime_from_timet_with_zone(1661280150, 0, NULL);
+#if 1
+ comp = icalcomponent_vanew(ICAL_VCALENDAR_COMPONENT,
+ icalproperty_new_version("2.0"),
+ icalproperty_new_prodid("PROD-ABC"),
+ icalproperty_new_uid("1234abcd"),
+ icalproperty_new_lastmodified(lm),
+ icalproperty_new_name("name1"),
+ 0);
+ icalcomponent_free(comp);
+#else
+ comp = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
+ icalcomponent_add_property(comp, icalproperty_new_version("2.0"));
+ icalcomponent_add_property(comp, icalproperty_new_prodid("PROD-ABC"));
+ icalcomponent_add_property(comp, icalproperty_new_uid("1234abcd"));
+ icalcomponent_add_property(comp, icalproperty_new_lastmodified(lm));
+ icalcomponent_add_property(comp, icalproperty_new_name("name1"));
+ icalcomponent_free(comp);
+#endif
+}
+
int main(int argc, char *argv[])
{
#if !defined(HAVE_UNISTD_H)
@@ -5130,6 +5156,7 @@ int main(int argc, char *argv[])
test_run("Test icalvalue resets timezone on set", test_icalvalue_resets_timezone_on_set, do_test, do_header);
test_run("Test removing TZID from DUE with icalcomponent_set_due", test_remove_tzid_from_due, do_test, do_header);
test_run("Test commas in x-property", test_comma_in_xproperty, do_test, do_header);
+ test_run("Test icalcomponent_vanew with lastmodified property", test_icalcomponent_with_lastmodified, do_test, do_header);
/** OPTIONAL TESTS go here... **/