summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Fix recurrence rule expansion with ordered weekdayLars Henriksen2020-05-122-0/+14
| | | | | | | | | | | | | | When the order of a weekday in BYDAY rule expansion (like -5SA or 5SU for monthly or 55WE for yearly) exceeds the number of available weekdays in the period (month or year), rule expansion with negative order could result in a floating point exception. The reason: the modified frequency might become zero. Solution. Check order against number of available weekdays and terminate expansion early whenever possible (also for positive orders). Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Take value data type of event start into account in iCal import/exportLars Henriksen2020-05-032-4/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch derives the item type (appointment or event) from the DTSTART value type. It is then used to perform an extended check of date/time values and reject non-conformant import files (like those reported in Github issues #81, (calcurse) events. The patch includes parsing and code corrections and minor refactoring. Background: Ical events are of two types, in calcurse called appointments and events. RFC 5545 has no distinguishing names for them, but describes them in section 3.6.1. The event type is derived from the value type of the DTSTART property. The value type may be either DATE-TIME (appointment) or DATE (event). If not specified by a VALUE property parameter in DTSTART, the default value type is DATE-TIME. The value type must be set explicitly to DATE to get an event. Other properties and rrule parts must agree with the DTSTART value type (DTEND, DURATION, EXDATE and UNTIL). Previously the type of an imported event was derived from the format of the DTSTART value. The DTSTART value type was not taken into account when importing, and not specified for recurring events when exporting (commit 0114289 solved it for events, see GitHub PR #97). Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Tests for recurrence rule extensionsLars Henriksen2020-04-284-1/+5411
| | | | | | Test cases include all the examples from RFC5545 which are supported. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Extend use of note file for iCal importLars Henriksen2020-04-285-10/+198
| | | | | | | | | | iCal import to an item note file is extended from DESCRIPTION to LOCATION, COMMENT and STATUS for both events and todos. Addresses GitHub issue #9. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Accept empty DESCRIPTION in ical importLars Henriksen2020-04-281-2/+3
| | | | | | | Adresses GitHub issue #274. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Extend iCalendar import testsLars Henriksen2020-03-227-1/+165
| | | | | | | | Tests ical-010.sh and ical-011.sh assume that Github issue #265 has been fixed (escape-encoding by export). Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix decoding of escaped characters in imported textLars Henriksen2020-03-222-3/+3
| | | | | | | | Stick strictly to RFC 5545, 3.3.11, Text, for SUMMARY and DESCRIPTION. Adresses Github issue #271. Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Improve ical import loggingLars Henriksen2020-03-228-8/+8
| | | | | | | | | The log file is not deleted if items were skipped (adresses Github issue #269). The log file includes the import file name and time. The import line numbers have been corrected (and tests amended). Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2020-01-301-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Test for the directory structureNitroretro2019-12-237-0/+74
| | | | | | | | Ensure that calcurse uses the right data and configuration directories depending on the conditions. Helped-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Change documentation to reflect the new file structureNitroretro2019-12-231-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* test/Makefile.am: Add apts-dst to EXTRA_DISTLukas Fleischer2019-10-181-0/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Test for DST and recurrent itemsLars Henriksen2019-10-183-1/+317
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Test cases for "Fix monthly and yearly recurrence algorithms"Lars Henriksen2019-09-063-1/+35
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Test cases for impossible dates in recurrence ruleLars Henriksen2019-05-203-1/+54
| | | | | Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* New test cases for next appoinmentLars Henriksen2019-04-133-0/+40
| | | | | | | | The change by commit "Fix display of time left before next appointment" is not detected by the existing test because the time set has zero seconds. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* CLI: tests alignedLars Henriksen2019-01-073-3/+3
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix priority parsing in iCal importsdott2018-11-243-3/+3
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* test/Makefile.am: Add missing data file to EXTRA_DISTLukas Fleischer2017-11-021-0/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* ical-002: Fix broken testLukas Fleischer2017-08-281-0/+2
| | | | | | | | | | | In the expected output, the punctual appointment (lasting one second in the iCal data) was missing. The test was not failing because calcurse did not print the missing item due to a bug. This bug was fixed by 7924315 (Fix support for punctual appointments at 00:00, 2017-08-28), making the test case fail. Fix the test case as well such that everything behaves as expected again. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Gracefully parse iCal parameters with colonsLukas Fleischer2017-02-073-0/+41
| | | | | | | | | | | | According to RFC 5545, iCalendar content lines can have optional parameters, which can be quoted strings containing colons (":"). Make sure that such colons are not interpreted as delimiters marking the start of the value string. Also, add a test case that covers this corner case. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2017-01-121-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Do not assume that days always have 86400 secondsLukas Fleischer2016-03-273-0/+18
| | | | | | | | Make that date membership is computed correctly, even if a day has less than 86400 seconds (e.g. after changing clocks). Reported-by: Hakan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix tests to match the new item orderingLukas Fleischer2016-02-184-17/+17
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Update copyright rangesLukas Fleischer2016-01-301-1/+1
| | | | Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix two iCal import testsLukas Fleischer2016-01-282-2/+2
| | | | | | | | When importing iCal files, VTODO entries without an priority are now imported with undefined priority (internally represented as zero), not with lowest priority 9. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Fix behavior of --todo with an optional argumentLukas Fleischer2016-01-282-2/+2
| | | | | | | | | | The previous behavior of --todo was to always only list uncompleted items, unless zero was specified as additional argument. Restore and document this behavior. Also, fix two tests that failed because the --todo output is now sorted. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
* Add support for UTC times in iCal importsLukas Fleischer2015-02-233-0/+39
| | | | | | | | | | | | | | According to the iCal standard (4.3.12 Time): UTC time, or absolute time, is identified by a LATIN CAPITAL LETTER Z suffix character (US-ASCII decimal 90), the UTC designator, appended to the time value. Parse such time values properly when importing iCal files. Fixes GitHub issue #3. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2015-02-071-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Handle dates past January 19th, 2038Lukas Fleischer2015-02-072-0/+31
| | | | | | Try to support dates past year 2038 on systems with 64-bit time_t. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/data/ical-006.ical: Remove timezonesLukas Fleischer2014-08-181-12/+12
| | | | | | | This are neither needed for the tests nor supported by the iCal import. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/Makefile.am: Add missing testLukas Fleischer2014-08-181-0/+2
| | | | | | | We added ical-005 in f3fe3c8 (Gracefully handle all day events in iCal imports, 2014-08-18) but forgot to add entries to the Makefile. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Correctly parse all types of iCal durationsLukas Fleischer2014-08-183-0/+108
| | | | | | | | This was supposed to be fixed in 6ca2535 (ical.c: Simplify and fix ical_durtime2long(), 2014-07-28) but some cases were not covered. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Gracefully handle all day events in iCal importsLukas Fleischer2014-08-182-0/+49
| | | | | | | | | Do not create two events when importing an event that lasts an entire day. Reported-by: Jörn Tillmanns <tillmanns@tuxzone.org> Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Handle CRLF line endings in iCal filesLukas Fleischer2014-08-183-0/+42
| | | | | | | | RFC 2445 mentions that CRLF line endings may be used in iCal files. Handle them properly when importing. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/: Fix date in ical-001Lukas Fleischer2014-08-182-4/+4
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use backwards-compatible out format for queriesLukas Fleischer2014-08-063-0/+38
| | | | | | | | | | | Print TODO items before appointments in query outputs and add an empty line between the list of TODO items and the list of appointments. This is how items were printed before the big parser refactoring. Also, add a test to ensure we do not unintentionally change that format in the future. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* tests/: Add basic iCal import testsLukas Fleischer2014-07-287-0/+267
| | | | | | | | Tests ical-002.sh and ical-003.sh currently fail due to bugs in duration and exception parsing. Reported-by: Håkan Jerning <jerning@home.se> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/: Remove temporary errors file in testsLukas Fleischer2014-07-0820-0/+20
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/Makefile.am: Add missing test dataLukas Fleischer2014-07-081-0/+27
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Implement test initialization properlyLukas Fleischer2014-07-0849-49/+52
| | | | | | | Make test-init.sh work even if tests are executed from another directory. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use tabs instead of spaces for indentationLukas Fleischer2013-04-141-149/+152
| | | | | | | | | | | This completes our switch to the Linux kernel coding style. Note that we still use deeply nested constructs at some places which need to be fixed up later. Converted using the `Lindent` script from the Linux kernel code base, along with some manual fixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/: Add default values for configuration variablesLukas Fleischer2013-02-2750-7/+102
| | | | | | | | | | | Add a small helper script called "test-init.sh" that is sourced in each test case and initializes the CALCURSE and DATA_DIR environment variables. Update the test suite README to point out that setting these environment variables is no longer required. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/: Add a couple of black-box tests for itemsLukas Fleischer2013-02-2755-0/+251
| | | | | | | This introduces five test suite failures which will be fixed in one of the following patches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2013-02-041-1/+1
| | | | | | | Add 2013 to the copyright range for all source and documentation files. Reported-by: Frederic Culot <frederic@culot.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/: Use `faketime -f`Lukas Fleischer2012-12-227-7/+11
| | | | | | | | | | | | Use the advanced timestamp specification format for libfaketime. Before using that, some tests failed on 32-bit systems due to integer overflows. It seems like faketime translates absolute dates to relative dates by default. Moreover, libfaketime is not able to handle relative dates that exceed the maximum value of a signed integer. Using "-f" skips the conversion to relative dates. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/: Do not error out if libfaketime is missingLukas Fleischer2012-12-228-8/+8
| | | | | | | | If the faketime library is missing, show a warning and skip the test. However, do not error out to make sure the test suite is able to terminate successfully on systems without libfaketime. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/Makefile.am: Add missing files to EXTRA_DISTLukas Fleischer2012-12-051-1/+7
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* run-test.c: Return failure if actual output is too shortLukas Fleischer2012-11-261-0/+3
| | | | | | | | | | | | | | We always terminated run-test when reached the end of the expected output and returned success if actual output and expected output were the same up to this point. This resulted in run-test always returning successfully if the actual output was a prefix of the expected output, even if it was a proper prefix. Check if the expected output contains more data after string comparison has finished to ensure we only return successfully if both outputs are actually equal. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* test/: Add a couple of tests for recurrent itemsLukas Fleischer2012-11-267-1/+135
| | | | | | | | | | | | | This adds tests for following features/scenarios: * Recurrent appointments and events of all (repetition) types. * Recurrent appointments with a duration of more than 24 hours. * Overlapping recurrent appointments. * Recurrent items and leap years. * Recurrent items with an end date. * Recurrent items with exceptions. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>