diff options
author | Allen Winter <allen.winter@kdab.com> | 2022-10-06 15:17:04 -0400 |
---|---|---|
committer | Allen Winter <allen.winter@kdab.com> | 2022-10-06 15:17:04 -0400 |
commit | 6c0a830af64fb40d1db0f32135dc30c280af6cca (patch) | |
tree | 5fc7bcf5b70e9cf7d1dc36648277f427e97e5859 /src/test | |
parent | 537642936828ec21c1fb5543dfe85d9898ed9232 (diff) | |
parent | a3757f078af3049bd6dbab377b13e7cecd08eb31 (diff) | |
download | libical-git-6c0a830af64fb40d1db0f32135dc30c280af6cca.tar.gz |
Merge branch '3.0'
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regression-component.c | 28 | ||||
-rw-r--r-- | src/test/regression.c | 48 | ||||
-rw-r--r-- | src/test/testmime.c | 2 |
3 files changed, 45 insertions, 33 deletions
diff --git a/src/test/regression-component.c b/src/test/regression-component.c index e5ce534b..0541a61b 100644 --- a/src/test/regression-component.c +++ b/src/test/regression-component.c @@ -273,11 +273,11 @@ void create_new_component_with_va_args() (void *)0), (void *)0); - ok("creating a complex vcalendar", (calendar != NULL)); if (VERBOSE && calendar) printf("%s\n", icalcomponent_as_ical_string(calendar)); icalcomponent_free(calendar); + ok("creating a complex vcalendar", (calendar != NULL)); } static void print_span(int c, struct icaltime_span span) @@ -327,19 +327,19 @@ void test_icalcomponent_get_span() c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1, 0, azone), - icalparameter_new_tzid("America/Los_Angeles"), 0), + icalparameter_new_tzid("America/Los_Angeles"), (void *)0), icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2, 0, azone), icalparameter_new_tzid("America/Los_Angeles"), 0), (void *)0); span = icalcomponent_get_span(c); + icalcomponent_free(c); if (VERBOSE) print_span(tnum++, span); #if ADD_TESTS_BROKEN_BUILTIN_TZDATA int_is("America/Los_Angeles", span.start, 973350000); #endif - icalcomponent_free(c); /** test 2 * We specify times as floating, the returned span is in UTC @@ -347,8 +347,8 @@ void test_icalcomponent_get_span() */ c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, - icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1, 0, NULL), 0), - icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2, 0, NULL), 0), + icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1, 0, NULL), (void *)0), + icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2, 0, NULL), (void *)0), (void *)0); span = icalcomponent_get_span(c); @@ -366,19 +366,19 @@ void test_icalcomponent_get_span() c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1, 0, azone), - icalparameter_new_tzid("America/New_York"), 0), + icalparameter_new_tzid("America/New_York"), (void *)0), icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2, 0, azone), - icalparameter_new_tzid("America/New_York"), 0), + icalparameter_new_tzid("America/New_York"), (void *)0), (void *)0); span = icalcomponent_get_span(c); + icalcomponent_free(c); if (VERBOSE) print_span(tnum++, span); #if ADD_TESTS_BROKEN_BUILTIN_TZDATA int_is("America/New_York", span.start, 973360800); #endif - icalcomponent_free(c); /** test 4 * We specify times in two different timezones, the returned span @@ -389,19 +389,19 @@ void test_icalcomponent_get_span() c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1, 0, azone), - icalparameter_new_tzid("America/New_York"), 0), + icalparameter_new_tzid("America/New_York"), (void *)0), icalproperty_vanew_dtend(icaltime_from_timet_with_zone(tm2, 0, bzone), - icalparameter_new_tzid("America/Los_Angeles"), 0), - (void *)0); + icalparameter_new_tzid("America/Los_Angeles"), (void *)0), + (void *)0); span = icalcomponent_get_span(c); + icalcomponent_free(c); if (VERBOSE) print_span(tnum++, span); #if ADD_TESTS_BROKEN_BUILTIN_TZDATA int_is("America/New_York", span.start, 973360800); #endif - icalcomponent_free(c); /** test 5 * We specify start time in a timezone and a duration, the returned span @@ -413,18 +413,18 @@ void test_icalcomponent_get_span() c = icalcomponent_vanew( ICAL_VEVENT_COMPONENT, icalproperty_vanew_dtstart(icaltime_from_timet_with_zone(tm1, 0, azone), - icalparameter_new_tzid("America/Los_Angeles"), 0), + icalparameter_new_tzid("America/Los_Angeles"), (void *)0), icalproperty_new_duration(dur), (void *)0); span = icalcomponent_get_span(c); + icalcomponent_free(c); if (VERBOSE) print_span(tnum++, span); #if ADD_TESTS_BROKEN_BUILTIN_TZDATA int_is("America/Los_Angeles w/ duration", span.end, 973351800); #endif - icalcomponent_free(c); icalerror_set_errors_are_fatal(0); /** test 6 diff --git a/src/test/regression.c b/src/test/regression.c index 67228d34..d00979c3 100644 --- a/src/test/regression.c +++ b/src/test/regression.c @@ -525,11 +525,10 @@ void test_components() (void *)0), icalproperty_vanew_xlicerror( "This is only a test", - icalparameter_new_xlicerrortype( - ICAL_XLICERRORTYPE_COMPONENTPARSEERROR), + icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_COMPONENTPARSEERROR), (void *)0), - 0), - 0); + (void *)0), + (void *)0); if (VERBOSE) printf("Original Component:\n%s\n\n", icalcomponent_as_ical_string(c)); @@ -542,7 +541,6 @@ void test_components() printf("Child Component:\n%s\n\n", icalcomponent_as_ical_string(child)); str_is("test results of child component", icalcomponent_as_ical_string(child), good_child); - icalcomponent_free(c); estate = icalerror_get_errors_are_fatal(); @@ -1148,12 +1146,9 @@ void test_restriction() (void *)0); valid = icalrestriction_check(comp); - - ok("icalrestriction_check() == 0", (valid == 0)); - (void)icalcomponent_as_ical_string(comp); - icalcomponent_free(comp); + ok("icalrestriction_check() == 0", (valid == 0)); } void test_calendar() @@ -5070,9 +5065,9 @@ static void test_implicit_dtend_duration(void) ICAL_VCALENDAR_COMPONENT, icalcomponent_vanew( ICAL_VEVENT_COMPONENT, - icalproperty_vanew_dtstart(start1, 0), - 0), - 0); + icalproperty_vanew_dtstart(start1, (void *)0), + (void *)0), + (void *)0); struct icaldurationtype d = icalcomponent_get_duration(c); struct icaltimetype end = icalcomponent_get_dtend(c), start = icaltime_from_string("20220108T101010Z"); @@ -5104,9 +5099,9 @@ static void test_implicit_dtend_duration(void) ICAL_VCALENDAR_COMPONENT, icalcomponent_vanew( ICAL_VTODO_COMPONENT, - icalproperty_vanew_dtstart(start1, 0), - 0), - 0); + icalproperty_vanew_dtstart(start1, (void *)0), + (void *)0), + (void *)0); icalcomponent_set_due(c, icaltime_from_string("20220109")); d = icalcomponent_get_duration(c); end = icalcomponent_get_dtend(c); @@ -5234,7 +5229,7 @@ static void test_remove_tzid_from_due(void) static void test_comma_in_xproperty(void) { - icalproperty *due = icalproperty_vanew_due(icaltime_from_string("20220120T120000"), 0); + icalproperty *due = icalproperty_vanew_due(icaltime_from_string("20220120T120000"), (void *)0); icalcomponent *c; icalproperty_add_parameter(due, icalparameter_new_tzid("America/New_York")); @@ -5253,8 +5248,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); @@ -5276,6 +5271,22 @@ 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); + 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"), + NULL); /* NOT 0! */ + icalcomponent_free(comp); +} + int main(int argc, char *argv[]) { #if !defined(HAVE_UNISTD_H) @@ -5438,6 +5449,7 @@ int main(int argc, char *argv[]) test_run("Test removing TZID from DUE with icalcomponent_set_due", test_remove_tzid_from_due, do_test, do_header); test_run("Test geo precision", test_geo_props, 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... **/ diff --git a/src/test/testmime.c b/src/test/testmime.c index df904868..2fd05cde 100644 --- a/src/test/testmime.c +++ b/src/test/testmime.c @@ -20,7 +20,7 @@ /*int sspm_parse_mime(struct sspm_part *parts, size_t max_parts, struct sspm_action_map *actions, - char* (*get_string)(char *s, size_t size, void* data), + char* (*get_string)(char *s, size_t size, void *data), void *get_string_data, struct sspm_header *first_header ); |