Commit graph

671 commits

Author SHA1 Message Date
Maxim Beder
68d4978b7d Add test for summary truncating long anotations
When calling summary command with :annotations hint, if the annotation
is longer than a certain length, it's going to be truncated. The issue
is that the length and truncation are done on a raw string without
considering UTF8 multibyte characters, so there are edge cases when an
annotation is truncated in the middle of a character creating an invalid
UTF8 string.

Added a test case for this scenario.

Signed-off-by: Maxim Beder <macsim.beder@gmail.com>
2023-04-14 12:23:16 +02:00
Thomas Lauf
082708a7ca Fix typos and wording
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-04 22:44:44 +02:00
Thomas Lauf
14bed139f6 Update copyrights
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-04 22:44:44 +02:00
Thomas Lauf
c6130157c6 Specify ranges without ':' in configuration
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-02 18:50:35 +02:00
Thomas Lauf
016d3a99e7 Update Ubuntu docker images
- Remove no longer supported version
- Add current version

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-01-14 00:16:09 +01:00
Thomas Lauf
ba0514543f Update Fedora docker images
- Remove no longer supported versions
- Add current versions

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-01-13 22:41:13 +01:00
Thomas Lauf
55ad661e0d Add tests for configurable report range, update man page
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-12-31 22:22:49 +01:00
Thomas Lauf
4a0ab1236d Add --details option
- extracts and prints affected tests

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-12-29 13:56:21 +01:00
Scott Mcdermott
bf26176243 Allow specification of intervals to the export command
This patch checks if intervals are given on cli to 'timew export', and
if so will filter only those numbered IDs out from the db.  This lets
the user that already knows the interval(s) they want to know about, to
ask for only those, without parsing the whole thing (similar to how we
can do this for taskwarrior IDs).

If both intervals and other filters -- time range or tags -- are given,
this is considered an error.  There would seem to be little use to AND
or OR tags/ranges with IDs because anyone that knew IDs to request would
already know those IDs met their requirement.

Fixes #510

Code additions from @lauft PR notes (thanks!):

- factor out 'filtering' so we can do only one call to getTracked()
- simplify (tag || range) to .empty(), which already checks both
- error message phrasing

Signed-off-by: Scott Mcdermott <scott@smemsh.net>
2022-12-28 22:13:35 +01:00
Thomas Lauf
25ff673521 Beautify tests
- Replace unused return variables with '_'
- Use 'expected' and 'actual' for test values
- Add whitespace

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-11-25 16:54:10 +01:00
Thomas Lauf
3d3faafcba Compare output of 'timew help start' to 'man timew-start'
The command timew help should redirect to the man tool.
Instead of testing that the header of the output matches some reg ex,
test that the outputs of `timew help` and `man` are equal

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-11-25 16:52:39 +01:00
Thomas Lauf
d8b7080dcb Compare output of command help with unknown argument with corresponding output of man command
The error message may be different depending on the man tool used.
Therefore, instead of hard-coding it into the test, ensure it is the same as produced by the man command

Closes #512

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-11-25 16:50:29 +01:00
Thomas Lauf
a38ecf6380 Add Alpine Linux test images
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-11-25 16:47:16 +01:00
Thomas Lauf
c80442c878 Make report 'totals.py' display data when no time range specified
Use interval array to determine whether there is data to display
Move interval truncation outside the loop, combine/rework 'no data' messages

Close #450

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-11-01 23:04:46 +01:00
Thomas Lauf
49c33591b8 Make report 'totals.py' truncate intervals to search range
Closes #505

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-11-01 18:32:56 +01:00
Thomas Lauf
598ddb24c8 Fix typo
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-09-27 23:33:43 +02:00
Thomas Lauf
8103d49e52 Use double quotes
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-09-27 23:33:43 +02:00
Thomas Lauf
d256580c4e Fix typos
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-08-17 21:23:43 +02:00
Thomas Lauf
a6322b4d71 Use python 10 on macOS runners
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-08-17 20:44:45 +02:00
Thomas Lauf
21a01dd3bc Fix CentOS 8 Dockerfile
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-08-17 20:02:12 +02:00
Thomas Lauf
993ae85d5c Add check whether requested intervals have been found when searching by ID
- Restores behaviour which got lost when switching to the new interval filtering in 9968b9e9
- Add test for each command

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-09 11:43:56 +01:00
Thomas Lauf
c2e26a989e Fix test description
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-05 23:44:12 +01:00
Thomas Lauf
ac2e94064f Fix padding in case single digit weeks are present
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2022-01-02 15:34:33 +01:00
Thomas Lauf
9968b9e9d1 Replace function getIntervalsByIds by getTracked with new filtering
Replace getIntervalsByIds in commands CmdAnnotate, CmdContinue, CmdDelete,
CmdJoin, CmdLengthen, CmdModify, CmdMove, CmdResize, CmdShorten, CmdSplit,
CmdTag, and CmdUntag

Relates to #468

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 22:31:15 +01:00
Thomas Lauf
e4eeca6755 Remove version constraint from fiu-utils and libfiu-dev
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-12-02 21:32:20 +01:00
Thomas Lauf
8d1b89db30 Improve performance-plot script
- Add option to select commands for display
- Use name of data directory as plot title

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-11-19 23:20:25 +01:00
Thomas Lauf
b87f4a1f5c Fix performance test for command stop
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-11-19 22:35:37 +01:00
Thomas Lauf
11a57e3cc5 Improve timemachine test-script
- Fix `--fail-at-end` option
- Collect errors and print report at end
- Make variable `tests` an array, add safeguards
- Combine cases
- Make variables `dates`, `hours`, `minutes` an array, add `pad_with_zero` function
- Execute test with specific 'runtime', so it picks up fake time
  - Python scripts are then executed as `faketime <date> python3 <test>`
  - Shell scripts as `faketime <date> bash <test>`
  - Everything else as `faketime <date> <test>`

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-11-12 21:59:07 +01:00
Thomas Lauf
00dc654813 Reactivate ArchLinux test image
- Switch to Docker Official Image (https://hub.docker.com/_/archlinux)
- Closes #412

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-06-13 22:30:40 +02:00
Thomas Lauf
5ecac5b407 Fix CMake installation on CentOS 8 test image
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-06-11 21:31:38 +02:00
Thomas Lauf
35dc22c8ef Enter commit hash for release 1.4.3
Set current version to `1.4.3-dev`
Fix test `version.t` to correctly verify version string

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-28 14:29:25 +02:00
Thomas Lauf
0b74e850fb Fix pyenv setup
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-27 22:02:02 +02:00
Thomas Lauf
29d3043f29 Update copyright ranges
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-27 21:11:32 +02:00
Thomas Lauf
379959e017 Optimize imports
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-05-27 21:11:31 +02:00
Shaun Ruffell
e170e344af test/modify: Remove a few unused variables
I left some unused varaibles in a new test functions after copy-paste.

This addresses @laufts comments on #423.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-05-19 12:22:22 +02:00
Shaun Ruffell
3ea086dcff Allow getTracked to match intervals that intersect with filter
It is not sufficient to stop looking for matching intervals if the
interval start time is before the filter. We really want to make sure
that we pick up any intervals that intersect with the filter.

Fixes bug introduced in (a98bd14 "Simplify getIntervalsById and
getTracked") as part of #423.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-05-19 12:22:22 +02:00
Shaun Ruffell
92697cc1ad test:opensuse1500: Update asciidoctor to 2.0.15
This also installs asciidoctor 2.0.15 explicitly so that if the latest
is changed upstream the update-alternatives line will not break.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-05-16 12:43:49 +02:00
Shaun Ruffell
bba56cc633 getIntervalsById: Only add truly synthetic intervals to synthetic vector
This fixes an error where the latest interval, a non-synthetic interval,
is added to the synthetic array (and marked synthetic) if flatten() is
otherwise not able to convert it to a group of synthetic intervals.

When modify was attempting to edit this interval, it would fail since
synthetic intervals should not be written to the database unless the
database is being flattened and timewarrior believed the interval to be
modified was synthetic.

Closes #422

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-05-16 12:43:49 +02:00
Thomas Lauf
4c8ccd99c3 Add Fedora 33 test image
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-04-10 23:15:30 +02:00
Thomas Lauf
a2507be7ea Add assertion for interval count
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-04-10 23:04:20 +02:00
Shaun Ruffell
0460656afe Allow tags to be enclosed in double quotes
Closes #159

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-04-10 22:52:04 +02:00
Shaun Ruffell
fd6d57dbc2 Use json::{encode|decode} for reading / writing JSON.
The JSON library in libshared has functions to esacpe JSON's special
characters, but they are not used by default.

Closes #416
Related to #261

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-04-10 22:52:04 +02:00
Shaun Ruffell
2897379b14 test:summary.t: Single digit week test should use logical or
The bitwise or, `|` had higher precendence than the `>` test. Fixes the
following error:

  not ok 4 - summary.t: Summary should work with :all hint
  # FAIL: AssertionError on file test/summary.t line 213 in test_with_all_hint: 'self.assertIn("""':
  #       '
  # Wk Date       Day ID Tags    Start      End    Time   Total
  # -- ---------- --- -- ---- -------- -------- ------- -------
  # W13 2021-04-04 Sun @3 FOO  10:00:00 11:00:00 1:00:00 1:00:00
  # W14 2021-04-05 Mon @2 BAR  10:00:00 11:00:00 1:00:00 1:00:00
  # W14 2021-04-06 Tue @1 BAZ  10:00:00 11:00:00 1:00:00 1:00:00
  #
  #                                                     3:00:00
  # ' not found in '
  # Wk  Date       Day ID Tags    Start      End    Time   Total
  # --- ---------- --- -- ---- -------- -------- ------- -------
  # W13 2021-04-04 Sun @3 FOO  10:00:00 11:00:00 1:00:00 1:00:00
  # W14 2021-04-05 Mon @2 BAR  10:00:00 11:00:00 1:00:00 1:00:00
  # W14 2021-04-06 Tue @1 BAZ  10:00:00 11:00:00 1:00:00 1:00:00
  #
  #                                                      3:00:00
  #
  # '

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-04-10 22:52:04 +02:00
Shaun Ruffell
d92ce2110f test: The tests depend on the documentation.
The help.t test wants to verify that some of the man pages exist.
Therefore we need to make sure the documentation is built, otherwise:

  $ git clean -ffdx .
  $ cmake -DCMAKE_BUILD_TYPE=Debug .
  $ make test

Will fail some of the help.t tests.

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2021-04-10 22:52:04 +02:00
Thomas Lauf
b189ccb020 Replace roff man pages with asciidoctor
This replaces the generation of man pages on project setup
by a on-demand generation via asciidoctor.
An exception are the man pages for the commands `day`, `month`, and `week`
which are simply redirects to the man page `timew-chart.1`. Those are now
static files in the Timewarrior repository.

A CMake find module to detect asciidoctor was added.
If asciidoctor is found, the targets `doc`, `man1`, and `man7` are created.
Those targets are also added to the default build target.

If asciidoctor is not available, the target `doc` is available, but it only
emits a message to install asciidoctor first.

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-02-21 20:58:30 +01:00
Thomas Lauf
65ef38658b Increase minimal CMake version
Compatibility with CMake < 2.8.12 will be removed from a future version of CMake.
According to our test images all supported distributions have CMake > 3

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-02-12 10:50:39 +01:00
Thomas Lauf
0fb7a88159 Ensure Ubuntu 16.04 docker image compiles Timewarrior with gcc >6
- libshared now requires C++14

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-01-26 13:36:54 +01:00
Thomas Lauf
ab240419df Ensure CentOS 7 docker image compiles Timewarrior with gcc >6
- libshared now requires C++14

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-01-26 13:36:03 +01:00
Thomas Lauf
1a6c30b93a Fix test summary.t for single-digit weeks
If summary is called during a single digit week, the respective column is only 2 characters wide

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2021-01-25 13:49:56 +01:00
Tomas Babej
e5870380a4
doc: Update copyright to 2021 2021-01-02 02:52:39 -05:00