2016-05-18 23:10:41 +03:00
|
|
|
# 1. nested includes in subdirectories
|
2015-07-12 21:54:08 +03:00
|
|
|
mkdir -p b/c/d ; printf '2010/1/1\n (D) 1\n' >b/c/d/d.journal ; printf '2010/1/1\n (C) 1\n!include d/d.journal\n' >b/c/c.journal ; printf '2010/1/1\n (B) 1\n!include c/c.journal\n' >b/b.journal ; printf '2010/1/1\n (A) 1\n!include b/b.journal\n' >a.journal ; hledger -f a.journal print; rm -rf a.journal b
|
2010-08-10 06:52:53 +04:00
|
|
|
>>>
|
2011-01-19 21:55:16 +03:00
|
|
|
2010/01/01
|
2017-06-05 07:26:18 +03:00
|
|
|
(A) 1
|
2010-08-10 06:52:53 +04:00
|
|
|
|
2011-01-19 21:55:16 +03:00
|
|
|
2010/01/01
|
2017-06-05 07:26:18 +03:00
|
|
|
(B) 1
|
2010-08-10 06:52:53 +04:00
|
|
|
|
2011-01-19 21:55:16 +03:00
|
|
|
2010/01/01
|
2017-06-05 07:26:18 +03:00
|
|
|
(C) 1
|
2010-08-10 06:52:53 +04:00
|
|
|
|
2011-01-19 21:55:16 +03:00
|
|
|
2010/01/01
|
2017-06-05 07:26:18 +03:00
|
|
|
(D) 1
|
2010-09-02 04:30:57 +04:00
|
|
|
|
2010-09-03 21:44:57 +04:00
|
|
|
>>>2
|
2011-08-15 02:15:39 +04:00
|
|
|
>>>=0
|
2016-05-18 23:10:41 +03:00
|
|
|
|
|
|
|
# 2. including other formats
|
|
|
|
hledger -f - print
|
|
|
|
<<<
|
|
|
|
2016/1/1
|
|
|
|
(x) 1
|
|
|
|
|
|
|
|
include a.timeclock
|
|
|
|
include b.timedot
|
|
|
|
>>>
|
|
|
|
2016/01/01
|
2017-06-05 07:26:18 +03:00
|
|
|
(x) 1.00
|
2016-05-18 23:10:41 +03:00
|
|
|
|
|
|
|
2016/01/01 * 12:00-16:00
|
2017-06-05 07:26:18 +03:00
|
|
|
(a:aa) 4.00h
|
2016-05-18 23:10:41 +03:00
|
|
|
|
2016-05-23 10:32:55 +03:00
|
|
|
2016/01/01 *
|
2017-06-05 07:26:18 +03:00
|
|
|
(b.bb) 1.00
|
2016-05-23 10:32:55 +03:00
|
|
|
|
2016-05-18 23:10:41 +03:00
|
|
|
>>>=0
|
2018-07-22 23:37:02 +03:00
|
|
|
|
|
|
|
# 3. include glob patterns
|
2018-08-16 01:05:37 +03:00
|
|
|
printf '2018/01/01\n (A) 1\n' >ab.journal; printf '2018/01/01\n (B) 1' >bb.journal; hledger -f - print; rm -f ab.journal bb.journal
|
2018-07-22 23:37:02 +03:00
|
|
|
<<<
|
2018-07-24 22:21:02 +03:00
|
|
|
include *b.journal
|
2018-07-22 23:37:02 +03:00
|
|
|
>>>
|
|
|
|
2018/01/01
|
|
|
|
(A) 1
|
|
|
|
|
2018-07-24 22:21:02 +03:00
|
|
|
2018/01/01
|
2018-07-22 23:37:02 +03:00
|
|
|
(B) 1
|
|
|
|
|
|
|
|
>>>=0
|
2018-07-23 15:36:45 +03:00
|
|
|
|
|
|
|
# 4. include invalid glob patterns
|
|
|
|
hledger -f - print
|
|
|
|
<<<
|
|
|
|
include [.journal
|
|
|
|
>>>=1
|
|
|
|
|
|
|
|
# 5. include nonexsitant file
|
|
|
|
hledger -f - print
|
|
|
|
<<<
|
|
|
|
include doesnotexist.journal
|
|
|
|
>>>=1
|
2018-10-10 02:12:57 +03:00
|
|
|
|
|
|
|
# 6. include relative to home
|
2018-10-10 03:16:47 +03:00
|
|
|
printf '2018/01/01\n (A) 1\n' >included.journal; HOME="$PWD" hledger -f - print; rm -rf included.journal
|
2018-10-10 02:12:57 +03:00
|
|
|
<<<
|
|
|
|
include ~/included.journal
|
|
|
|
>>>
|
|
|
|
2018/01/01
|
|
|
|
(A) 1
|
|
|
|
|
|
|
|
>>>2
|
|
|
|
>>>=0
|
2019-01-15 23:58:28 +03:00
|
|
|
|
2019-01-16 20:19:56 +03:00
|
|
|
# The next tests require hard coded file names, so are not concurrent-safe.
|
|
|
|
# They use different file names so a single concurrent shelltest invocation will be fine.
|
|
|
|
|
2019-01-15 23:58:28 +03:00
|
|
|
# 7. test that order of include files is maintained
|
|
|
|
printf 'include _b\n' >_a; touch _b; hledger -f _a stats | grep _ | sed -e 's%.*/%%'; rm -rf _a _b
|
|
|
|
>>>
|
|
|
|
_a
|
|
|
|
_b
|
|
|
|
>>>2
|
|
|
|
>>>=0
|
|
|
|
|
|
|
|
# 8. and with --auto code path
|
2019-01-16 20:19:56 +03:00
|
|
|
printf 'include _d\n=\n' >_c; touch _d; hledger -f _c stats --auto | grep _ | sed -e 's%.*/%%'; rm -rf _c _d
|
2019-01-15 23:58:28 +03:00
|
|
|
>>>
|
2019-01-16 20:19:56 +03:00
|
|
|
_c
|
|
|
|
_d
|
2019-01-15 23:58:28 +03:00
|
|
|
>>>2
|
|
|
|
>>>=0
|