33 Commits

Author SHA1 Message Date
Lars Henriksen
eda28d3fef Tests for recurrence rule extensions
Test cases include all the examples from RFC5545 which are supported.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-04-28 07:32:44 -04:00
Lars Henriksen
e9deb6fff3 Extend use of note file for iCal import
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>
2020-04-28 07:32:44 -04:00
Lars Henriksen
e535eff904 Extend iCalendar import tests
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>
2020-03-22 13:45:40 -04:00
Nitroretro
4a2f5e2183 Test for the directory structure
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>
2019-12-23 13:16:39 -05:00
Lukas Fleischer
1b43893c4c test/Makefile.am: Add apts-dst to EXTRA_DIST
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-10-18 17:18:01 -04:00
Lars Henriksen
e25710f650 Test for DST and recurrent items
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-10-18 16:29:34 -04:00
Lars Henriksen
1db1108e86 Test cases for "Fix monthly and yearly recurrence algorithms"
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-09-06 18:17:23 -04:00
Lars Henriksen
52d52208c8 Test cases for impossible dates in recurrence rule
Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-20 09:37:17 -04:00
Lars Henriksen
8741334d83 New test cases for next appoinment
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>
2019-04-13 11:58:16 +02:00
Lukas Fleischer
4dbb00c595 test/Makefile.am: Add missing data file to EXTRA_DIST
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-02 08:37:47 +01:00
Lukas Fleischer
e4e2e0eb20 Gracefully parse iCal parameters with colons
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>
2017-02-07 21:54:05 +01:00
Lukas Fleischer
9e160fac16 Do not assume that days always have 86400 seconds
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>
2016-03-27 13:06:18 +02:00
Lukas Fleischer
1ea97795be Add support for UTC times in iCal imports
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>
2015-02-23 10:46:16 +01:00
Lukas Fleischer
b157f99179 test/Makefile.am: Add missing test
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>
2014-08-18 15:18:11 +02:00
Lukas Fleischer
76f151ff37 Correctly parse all types of iCal durations
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>
2014-08-18 15:18:11 +02:00
Lukas Fleischer
bcc820ea74 Handle CRLF line endings in iCal files
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>
2014-08-18 11:37:41 +02:00
Lukas Fleischer
f9208c0b3d Use backwards-compatible out format for queries
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>
2014-08-06 15:48:02 +02:00
Lukas Fleischer
81894cbbd8 tests/: Add basic iCal import tests
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>
2014-07-28 12:43:00 +02:00
Lukas Fleischer
e97c32563f test/Makefile.am: Add missing test data
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-08 15:28:54 +02:00
Lukas Fleischer
7904af5d9d Implement test initialization properly
Make test-init.sh work even if tests are executed from another
directory.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2014-07-08 15:12:37 +02:00
Lukas Fleischer
5501dae328 test/: Add a couple of black-box tests for items
This introduces five test suite failures which will be fixed in one of
the following patches.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2013-02-27 11:36:28 +01:00
Lukas Fleischer
c6b5da3e16 test/Makefile.am: Add missing files to EXTRA_DIST
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-12-05 00:16:46 +01:00
Lukas Fleischer
0715a4433c test/: Add a couple of tests for recurrent items
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>
2012-11-26 20:23:05 +01:00
Lukas Fleischer
b526d46fae Add a test case to reproduce BUG#2
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-06-30 14:34:37 +02:00
Lukas Fleischer
f76e1cce40 test/: Use correct calcurse binary and data dir
We really don't want to use the calcurse(1) binary from "$PATH" here.
Introduce an environment variable "$CALCURSE" which can be used specify
the binary to use and set this variable to the binary located in the
build directory by default. Similarly, add another environment variable
"$DATA_DIR" that can be used to specify a data directory.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-02-24 22:48:26 +01:00
Lukas Fleischer
423bfcc9ac test/Makefile.am: Add tests to "EXTRA_DIST"
Add tests and the dummy data directory to "EXTRA_DIST" since we want
these to be shipped in distribution tarballs. Spotted with `make
distcheck`.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-02-24 22:48:25 +01:00
Lukas Fleischer
7c91248629 {src,test}/Makefile.am: Enable pedantic warnings
Now that we're fully POSIX compliant and fixed up some minor issues with
ISO C99, use "-std=c99 -pedantic -D_POSIX_C_SOURCE=200809L" as default
build flags for calcurse and the test suite.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-02-19 03:23:26 +01:00
Lukas Fleischer
dfc98b5fa1 test/: Add test case for "-S" (pattern search)
* search-001.sh: Compare the output of "-S <regex>" (using a regular
  expression) with hardcoded data.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-01-22 17:00:19 +01:00
Lukas Fleischer
cb69a4c087 test/: Add test cases for "-a" and "-n"
* appointment-001.sh: Compare output of "-a" with hardcoded data.
* next-001.sh: Compare output of "-n" with hardcoded data.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-01-22 16:40:00 +01:00
Lukas Fleischer
dbb19b7c25 test/: Add test cases for "-d" and "-s"/"-r"
* day-001.sh: Compare output of "-d<date>" with hardcoded data.
* day-002.sh: Compare output of "-d<num>" with hardcoded data.
* day-003.sh: Compare output of "-d<num>" with "-s<date> -r<num>".
* range-001.sh: Compare output of "-r" with hardcoded data.
* range-002.sh: Compare output of "-r<num>" with hardcoded data.
* range-003.sh: Compare output of "-r<num>" with "-s<date> -r<num>".

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-01-22 01:03:31 +01:00
Lukas Fleischer
32530f0e50 test/: Add generic tests for todo operations
* todo-001.sh: Tests the "-t" command line option (calculates expected
  output by parsing the todo data file).

* todo-002.sh: Tests "-t<num>" in a way similar to todo-001.sh.

* todo-003.sh: Tests "-t0" in a way similar to todo-001.sh.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-01-22 00:13:35 +01:00
Lukas Fleischer
31b4c71eb2 test/: Add three basic self tests
* true-001.sh: Always returns true - this should never ever fail.

* run-test-001.sh: Invokes run-test, passing itself as a parameter.
  Subsequently, it outputs the very same (hardcoded) expected and actual
  values.

* run-test-002.sh: Tests run-test's negative assertion feature in a way
  similar to run-test-001.sh. However, output different (hardcoded)
  expected and actual values and invoke run-test with the negative test
  prefix ('!').

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-01-22 00:13:35 +01:00
Lukas Fleischer
e66e2d4277 Add a minimal test suite
Introduce a new "test/" sub-directory that contains tests for calcurse.
Right now, it only includes the quick-and-dirty "run-test" helper that
can be used to run and verify tests:

    $ ./run-test test-1 test-2 test-3 test-4
    Running test-1... ok
    Running test-2... ok
    Running test-3... FAIL

Each argument passed to run-test must be a test script located in the
current directory. run-test invokes each script twice and passes the
command line argument "expected" and "actual", respectively. A test case
succeeds if both "expected" and "actual" instances return with a zero
exit status and produce exactly the same output. It fails otherwise.

run-test terminates with a non-zero exit status as soon as one of the
test fails.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
2012-01-21 23:06:32 +01:00