mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-20 02:37:12 +03:00
dev:add.test: convert to modern shelltest format
This commit is contained in:
parent
1fcc8f1c89
commit
202aff6549
@ -3,24 +3,24 @@
|
|||||||
# data validation
|
# data validation
|
||||||
#
|
#
|
||||||
# ** 1. should prompt again for a bad date
|
# ** 1. should prompt again for a bad date
|
||||||
<<<
|
<
|
||||||
2009/1/32
|
2009/1/32
|
||||||
$$$ hledger -f $$-add.j add; rm -f $$-add.j
|
$ hledger -f $$-add.j add; rm -f $$-add.j
|
||||||
>>> /A valid hledger smart date is required/
|
> /A valid hledger smart date is required/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
# ** 2. should accept a blank date
|
# ** 2. should accept a blank date
|
||||||
<<<
|
<
|
||||||
|
|
||||||
$$$ hledger -f $$-add.j add; rm -f $$-add.j
|
$ hledger -f $$-add.j add; rm -f $$-add.j
|
||||||
>>> /Date .*Description:/
|
> /Date .*Description:/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# precision and commodity handling
|
# precision and commodity handling
|
||||||
#
|
#
|
||||||
# ** 3. simple add with no existing journal, no commodity entered
|
# ** 3. simple add with no existing journal, no commodity entered
|
||||||
<<<
|
<
|
||||||
|
|
||||||
|
|
||||||
a
|
a
|
||||||
@ -28,40 +28,40 @@ a
|
|||||||
b
|
b
|
||||||
|
|
||||||
.
|
.
|
||||||
$$$ hledger -f $$-add.j add; rm -f $$-add.j
|
$ hledger -f $$-add.j add; rm -f $$-add.j
|
||||||
>>> /Date.*Description.*Account 1.*Amount 1.*Account 2.*Amount 2.*Account 3.*or \. or enter to finish.*/
|
> /Date.*Description.*Account 1.*Amount 1.*Account 2.*Amount 2.*Account 3.*or \. or enter to finish.*/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
# ** 4. default commodity with greater precision
|
# ** 4. default commodity with greater precision
|
||||||
<<<
|
<
|
||||||
|
|
||||||
|
|
||||||
a
|
a
|
||||||
$1000.0
|
A1000.0
|
||||||
b
|
b
|
||||||
|
|
||||||
.
|
.
|
||||||
|
|
||||||
$$$ printf 'D $1000.00\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
$ printf 'D A1000.00\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
||||||
>>> /a +\$1000\.0/
|
> /a +A1000\.0/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
# ** 5. default commodity with less precision
|
# ** 5. default commodity with less precision
|
||||||
<<<
|
<
|
||||||
|
|
||||||
|
|
||||||
a
|
a
|
||||||
$1000.00
|
A1000.00
|
||||||
b
|
b
|
||||||
|
|
||||||
.
|
.
|
||||||
|
|
||||||
$$$ printf 'D $1000.0\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
$ printf 'D A1000.0\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
||||||
>>> /a +\$1000\.00/
|
> /a +A1000\.00/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
# ** 6. default commodity symbol is added when not entered
|
# ** 6. default commodity symbol is added when not entered
|
||||||
<<<
|
<
|
||||||
|
|
||||||
|
|
||||||
a
|
a
|
||||||
@ -70,39 +70,39 @@ b
|
|||||||
|
|
||||||
.
|
.
|
||||||
|
|
||||||
$$$ printf 'D $1000.00\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
$ printf 'D A1000.00\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
||||||
>>> /a +\$1000\.00/
|
> /a +A1000\.00/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
# ** 7. existing commodity with greater precision
|
# ** 7. existing commodity with greater precision
|
||||||
<<<
|
<
|
||||||
|
|
||||||
|
|
||||||
a
|
a
|
||||||
$1000.0
|
A1000.0
|
||||||
b
|
b
|
||||||
|
|
||||||
.
|
.
|
||||||
$$$ printf '2010/1/1\n a $1000.00\n b\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
$ printf '2010/1/1\n a A1000.00\n b\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
||||||
>>> /a +\$1000\.0/
|
> /a +A1000\.0/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
# ** 8. existing commodity with less precision
|
# ** 8. existing commodity with less precision
|
||||||
<<<
|
<
|
||||||
|
|
||||||
|
|
||||||
a
|
a
|
||||||
$1000.00
|
A1000.00
|
||||||
b
|
b
|
||||||
|
|
||||||
.
|
.
|
||||||
|
|
||||||
$$$ printf '2010/1/1\n a $1000.0\n b\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
$ printf '2010/1/1\n a A1000.0\n b\n' >t$$.j; hledger -f t$$.j add >/dev/null; cat t$$.j; rm -f t$$.j
|
||||||
>>> /a +\$1000\.00/
|
> /a +A1000\.00/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
# ** 9. default amounts should not fail to balance due to precision
|
# ** 9. default amounts should not fail to balance due to precision
|
||||||
<<<
|
<
|
||||||
2010/1/1
|
2010/1/1
|
||||||
x
|
x
|
||||||
a
|
a
|
||||||
@ -110,19 +110,18 @@ a
|
|||||||
b
|
b
|
||||||
0.5
|
0.5
|
||||||
c
|
c
|
||||||
$$$ rm -f nosuch.journal; hledger -f nosuch.journal add; rm -f nosuch.journal
|
$ rm -f nosuch.journal; hledger -f nosuch.journal add; rm -f nosuch.journal
|
||||||
>>> /Amount 3 \[-0.75\]:/
|
> /Amount 3 \[-0.75\]:/
|
||||||
>>>2 //
|
>2 //
|
||||||
|
|
||||||
## 10. shouldn't add decimals if there aren't any
|
## 10. shouldn't add decimals if there aren't any
|
||||||
## printf '\n\na\n1\nb\n' | hledger -f /dev/null add
|
## printf '\n\na\n1\nb\n' | hledger -f /dev/null add
|
||||||
# hledger -f /dev/null add
|
# <
|
||||||
# <<<
|
#
|
||||||
|
#
|
||||||
|
|
||||||
# a
|
# a
|
||||||
# 1
|
# 1
|
||||||
# b
|
# b
|
||||||
# >>> /amount 2 \[-1\]/
|
# $ hledger -f /dev/null add
|
||||||
# >>>=0
|
# > /amount 2 \[-1\]/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user