;dev:timeclock: tests cleanup

This commit is contained in:
Simon Michael 2025-08-29 11:47:24 +01:00
parent db6714a120
commit 252f4bf13c

View File

@ -1,6 +1,7 @@
# * timeclock input # * timeclock input
# ** 1. a timeclock session is parsed as a similarly-named transaction with one virtual posting. # ** 1. a timeclock session is parsed as a similarly-named transaction with one virtual posting.
# "session" is a synonym for "account" here.
< <
i 2009/1/1 08:00:00 i 2009/1/1 08:00:00
o 2009/1/1 09:00:00 o 2009/1/1 09:00:00
@ -36,21 +37,21 @@ $ hledger -ftimeclock:- print --alias '/account/=FOO'
>= >=
# ** 3. For a missing clock-out, now is implied # ** 3. For session with no clock-out, an implicit clock-out at report time is assumed.
< <
i 2020/1/1 08:00 i 2020/1/1 08:00
$ hledger -f timeclock:- balance $ hledger -f timeclock:- balance
> /./ > /./
>= >=
# ** 4. For a log not starting with clock-in, print error # ** 4. A time log not starting with a clock-in is an error.
< <
o 2020/1/1 08:00 o 2020/1/1 08:00
$ hledger -f timeclock:- balance $ hledger -f timeclock:- balance
>2 /Could not find previous clockin to match this clockout./ >2 /Could not find previous clockin to match this clockout./
>= !0 >= !0
# ** 5. For two consecutive anonymous clock-ins, print error # ** 5. Two consecutive anonymous clock-ins is an error. (?)
< <
i 2020/1/1 08:00 i 2020/1/1 08:00
i 2020/1/1 09:00 i 2020/1/1 09:00
@ -58,8 +59,7 @@ $ hledger -f timeclock:- balance
>2 /Encountered clockin entry for session "" that is already active./ >2 /Encountered clockin entry for session "" that is already active./
>= !0 >= !0
# ** 6. Timeclock amounts are always rounded to two decimal places, # ** 6. Timeclock amounts are always rounded to two decimal places (#1527).
# even when displayed by print (#1527).
< <
i 2020-01-30 08:38:35 acct i 2020-01-30 08:38:35 acct
o 2020-01-30 09:03:35 o 2020-01-30 09:03:35
@ -69,59 +69,62 @@ $ hledger -f timeclock:- print
>= >=
# ** 7. Comments and tags are supported. Double space is required between account name # ** 7. Comments and tags are supported on the clock-in. Double space is required
# and description or comment. It is not required between description and comment. # between account name and description or comment, but not between description and comment.
< <
i 2023-05-01 08:00:00 acct 1 description ; a comment with tag: i 2023-05-01 08:00:00 acct 1 description ; a comment with tag:
o 2023-05-01 09:00:00 o 2023-05-01 09:00:00
i 2023-05-02 08:00:00 acct 2 ; another comment i 2023-05-02 08:00:00 acct 2 ; another comment
o 2023-05-02 09:00:00 o 2023-05-02 09:00:00
$ hledger -f timeclock:- print tag:tag $ hledger -f timeclock:- print tag:tag
2023-05-01 * description ; a comment with tag: 2023-05-01 * description ; a comment with tag:
(acct 1) 1.00h (acct 1) 1.00h
>= >=
# ** 8. # ** 8. TODO Comments on clock-outs are ignored / added to posting / added to transaction.
$ hledger -f timeclock:- accounts # XXX
acct 1
acct 2
# ** 9. Support multiple sessions simultaneously clocked in.
< <
i 2025-03-10 08:00:00 multi:1 description 1 i 2025-01-01 09:00:00 session1
i 2025-03-10 09:00:00 multi:2 description 2 ; note that these entries are both active o 2025-01-01 10:00:00 ; clock-out comment
o 2025-03-10 12:00:00 multi:1 $
o 2025-03-10 15:00:00 multi:2 #$ hledger -f timeclock:- print
# ** 9. Multiple sessions can be simultaneously clocked in. Clockouts can be named and in any order.
<
i 2025-01-01 09:00:00 session1 9 to 5 session
i 2025-01-01 12:00:00 session2 12 to 2 session, overlapping
o 2025-01-01 14:00:00 session2
o 2025-01-01 17:00:00 session1
$ hledger -f timeclock:- print $ hledger -f timeclock:- print
> >
2025-03-10 * description 1 2025-01-01 * 9 to 5 session
(multi:1) 4.00h (session1) 8.00h
2025-03-10 * description 2 ; note that these entries are both active 2025-01-01 * 12 to 2 session, overlapping
(multi:2) 6.00h (session2) 2.00h
>= >=
# ** 10. Implicit clockouts apply to the correct session. # ** 10. Unnamed clockouts apply to the most recently clocked-in session.
# The first 'o' here applies to multi:3, the next explicitly to multi:1, and the third to multi:2.
< <
i 2025-03-10 08:00:00 multi:1 description 1 i 2025-01-01 09:00:00 session1 start 9-12
i 2025-03-10 09:00:00 multi:2 description 2 i 2025-01-01 10:00:00 session2 start 10-5
i 2025-03-10 10:00:00 multi:3 description 3 i 2025-01-01 11:00:00 session3 start 11-1
o 2025-03-10 11:00:00 o 2025-01-01 13:00:00
o 2025-03-10 12:00:00 multi:1 o 2025-01-01 12:00:00 session1
o 2025-03-10 15:00:00 o 2025-01-01 17:00:00
$
$ hledger -f timeclock:- print $ hledger -f timeclock:- print
> 2025-01-01 * start 9-12
2025-03-10 * description 1 (session1) 3.00h
(multi:1) 4.00h
2025-03-10 * description 2 2025-01-01 * start 10-5
(multi:2) 6.00h (session2) 7.00h
2025-03-10 * description 3 2025-01-01 * start 11-1
(multi:3) 1.00h (session3) 2.00h
>= >=
@ -170,8 +173,32 @@ $ hledger --old-timeclock -f timeclock:- print
>= >=
## TODO # ** 13. TODO Overlapping sessions can have the same name (#2417).
<
i 2024-04-10 13:00:00 test
o 2024-04-10 14:00:00
i 2024-04-10 13:00:00 test
o 2024-04-10 15:00:00
$
# $ hledger -f timeclock:- print
# >=
# ** 14. TODO A start time can be the same as another session's end time (#2417).
<
i 2024-04-10 13:00:00 test
o 2024-04-10 14:00:00
i 2024-04-10 14:00:00 test
o 2024-04-10 15:00:00
$
# $ hledger -f timeclock:- print
# >=
# ** OLD:
## multi-day sessions get a new transaction for each day ## multi-day sessions get a new transaction for each day
# The --old-timeclock flag reverts to the old behavior.
#hledger -ftimeclock:- print #hledger -ftimeclock:- print
#<<< #<<<
#i 2017/04/20 09:00:00 A #i 2017/04/20 09:00:00 A