Commit graph

696 commits

Author SHA1 Message Date
Thomas Lauf
ea95ca8a70 Update copyright ranges
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-12-23 23:14:46 +01:00
Thomas Lauf
bf683eedbf Filter summary based on ids
Closes  #573

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-12-23 22:38:31 +01:00
Thomas Lauf
7b4a234f03 Unify coding style
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-12-23 22:38:31 +01:00
Thomas Lauf
054af9c1e9 Remove restriction for annotation display
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-10-31 10:07:37 +01:00
Thomas Lauf
67c5b7de6c Refactor UnitTest class
- Use UnitTest::ok in UnitTest::notok
- Extract report_* functions
- Extract common color function and constants
- Use templates to reduce code duplication
2023-10-14 19:44:27 +02:00
Thomas Lauf
6d79ea4a6d Update copyright statements
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-09-18 12:33:17 +02:00
Thomas Lauf
a72659f753 Move test for 'untag' from 'tag.t' to 'untag.t'
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-08-11 20:50:29 +02:00
Thomas Lauf
8e96ad5229 Add functions to add/remove a set of tags to/from an interval
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-08-11 19:25:47 +02:00
Iúri Archer
4469e9056a
Add retag command (#551)
Closes #515 

---------

Signed-off-by: cyberme0w <iuri_archer@hotmail.com>
2023-07-31 22:45:08 +02:00
Shaun Ruffell
7a75210ce1 AtomicFile: Operate on the target of symlinks
Currently, if an AtomicFile is opened on a symlink, the AtomicFile would
end up overwriting the link. This change makes AtomicFiles operate on
the targets of the links and not the links themselves.

```
$ test/AtomicFileTest
1..22
ok 1 - AtomicFileTest: Shall not exists before finalize
ok 2 - AtomicFileTest: Shall exists after finalize
ok 3 - AtomicFileTest: Shall have the correct data
ok 4 - AtomicFileTest: Neither shall exist before finalize
ok 5 - AtomicFileTest: Both shall exists after finalize
ok 6 - AtomicFileTest: First file shall contain the correct data
ok 7 - AtomicFileTest: Second file shall contain the correct data
ok 8 - AtomicFileTest: Appending does not update original before finalize
ok 9 - AtomicFileTest: Finalizing updates the appended data
ok 10 - AtomicFileTest: Read from Atomicfile
ok 11 - AtomicFileTest: Read from Atomicfile should read unfinalized data
ok 12 - AtomicFileTest: Two AtomicFiles should access same temp file (part 1)
ok 13 - AtomicFileTest: Two AtomicFiles should access same temp file (part 2)
ok 14 - AtomicFileTest: Two AtomicFiles should access same temp file (part 3)
ok 15 - AtomicFileTest: File not removed before finalize
ok 16 - AtomicFileTest: File is removed after finalize
ok 17 - AtomicFileTest: writes to symlinks end up in target
ok 18 - AtomicFileTest: shall maintain symlink
ok 19 - AtomicFileTest: AtomicFile::write_raw throws on error # skip
ok 20 - AtomicFileTest: AtomicFile::finalize_all() throws on error # skip
ok 21 - AtomicFileTest: AtomicFile::reset clears failure state # skip
ok 22 - AtomicFileTest: AtomicFile::append throws on error # skip
ok 23 - AtomicFileTest: AtomicFile::append did not partially fill the file. # skip
ok 24 - AtomicFileTest: AtomicFile::append failures prevent finalization # skip
```

Fixes #546

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2023-06-23 17:35:00 +02:00
Shaun Ruffell
c67a4715f8 AtomicFileTest: Fix test output to be test/problems --details compliant
Before this change, when AtomicFileTest had errors, there was no match for details:
```
$ test/problems --details test/all.log
Traceback (most recent call last):
  File "test/problems", line 145, in <module>
    details_errors[filename] += " - " + detail.match(line).group(1) + "\n"
AttributeError: 'NoneType' object has no attribute 'group'
```

Now the details are pulled out properly:
```
$ test/problems --details test/all.log
Failed:
AtomicFile.t (2):
 - AtomicFile::write_raw throws on error
 - AtomicFile::finalize_all() throws on error

Unexpected successes:

Skipped:

Expected failures:
```

Why these tests are failing on this particular host is a matter for another time...

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
2023-06-23 17:35:00 +02:00
Thomas Lauf
26f2791d6b Set correct application name in test suite run script
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-06-17 14:19:02 +02:00
Thomas Lauf
c6aa8815a2 Make CMake/Make signal start of test suite run
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-06-17 14:19:02 +02:00
Thomas Lauf
34bba44d38 Replace CLI::getFilter by CLI::getRange and CLI::getTags
- Add CLI::getRange
- Make CLI::getTags return a set instead of a vector. This has the side effect that the tags are sorted now...
- Replace variable 'filter' by 'range' and 'tags'. Variable 'filter' was just a wrapper, better use the components directly
2023-06-17 14:19:02 +02:00
Thomas Lauf
f346142560 Fix output redirection
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-06-17 14:19:02 +02:00
Thomas Lauf
9299fd3e39 Apply Clang-Tidy
Use emplace_back instead of push_back
Use 'nullptr'
Use function 'empty ()' instead of 'size () == 0'
Mark single-argument constructors as 'explicit'
Call static function correctly
2023-06-17 14:19:02 +02:00
Thomas Lauf
2535c2c399 Cleanup includes
- Remove unused includes
- Use '<..>' style consistently
- Strip any paths from include
- Replace deprecated C++ headers
- Sort includes according to LLVM rules
  https://llvm.org/docs/CodingStandards.html#include-style

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-06-17 14:19:02 +02:00
Thomas Lauf
3008e458e9 Update project to C++17
- Bump CMake to minimum version 3.8
- Set C++ standard to 17
- Remove CMAKE_LEGACY_CYGWIN_WIN32 compatibility mode
- Remove C++11 stuff
- Update documentation

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-06-17 08:41:07 +02:00
Thomas Lauf
20a8a4a4cc Cleanup CMake files
- Replace tabs with spaces
- Use lowercase for CMake commands
- Unify alignment
- Remove superfluous empty line
- Add space after CMake command

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-05-26 09:53:03 +02:00
Thomas Lauf
5b87c962e7 Polish up bash scripts
- Use '-n' instead of '! -z'
- Quote all the things...
- Enclose variable references in '{}'

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-18 23:18:43 +02:00
Thomas Lauf
14d364bff7 Drop unused assignments
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-17 08:17:29 +02:00
Thomas Lauf
81225722aa Remove stuff for Python < 3.7
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-17 08:17:29 +02:00
Thomas Lauf
2a73e3bc77 Add quotes to soothe spell checker
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-17 08:17:29 +02:00
Thomas Lauf
a1d418a686 Fix grammar and spelling
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-17 08:17:29 +02:00
Thomas Lauf
70a1082224 Use local man pages in tests
We need to set the value of `MANPATH` to the local man pages when running helper function 'run_cmd_wait_nofail'.
Use the already set Timewarrior environment for this.

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2023-04-14 13:50:35 +02:00
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