101 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			101 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| ##############################################################################
 | |
| # data validation
 | |
| #
 | |
| # should prompt again for a bad date
 | |
|  rm -f add-default-commodity-$$.j; bin/hledger -f add-default-commodity-$$.j add; rm -f add-default-commodity-$$.j
 | |
| <<<
 | |
| 2009/1/32
 | |
| >>> /date .*: date .*/
 | |
| #
 | |
| # should accept a blank date
 | |
|  rm -f add-default-commodity-$$.j; bin/hledger -f add-default-commodity-$$.j add; rm -f add-default-commodity-$$.j
 | |
| <<<
 | |
| 
 | |
| >>> /date .*: description/
 | |
| #
 | |
| ##############################################################################
 | |
| # precision and commodity handling
 | |
| #
 | |
| # simple add with no existing journal, no commodity entered
 | |
|  rm -f add-default-commodity-$$.j; bin/hledger -f add-default-commodity-$$.j add; rm -f add-default-commodity-$$.j
 | |
| <<<
 | |
| 
 | |
| 
 | |
| a
 | |
| 1000.0
 | |
| b
 | |
| 
 | |
| .
 | |
| >>> /^date \[.*\]: description \[\]: account 1: amount  1: account 2: amount  2 \[-1000\]: account 3: date \[.*\]: $/
 | |
| #
 | |
| # default commodity with greater precision
 | |
|  printf 'D $1000.00\n' >add-default-commodity-$$.j; hledger -fadd-default-commodity-$$.j add >/dev/null; cat add-default-commodity-$$.j; rm -f add-default-commodity-$$.j
 | |
| <<<
 | |
| 
 | |
| 
 | |
| a
 | |
| $1000.0
 | |
| b
 | |
| 
 | |
| .
 | |
| >>> /a  +\$1000\.0/
 | |
| #
 | |
| # default commodity with less precision
 | |
|  printf 'D $1000.0\n' >add-default-commodity-$$.j; hledger -fadd-default-commodity-$$.j add >/dev/null; cat add-default-commodity-$$.j; rm -f add-default-commodity-$$.j
 | |
| <<<
 | |
| 
 | |
| 
 | |
| a
 | |
| $1000.00
 | |
| b
 | |
| 
 | |
| .
 | |
| >>> /a  +\$1000\.00/
 | |
| #
 | |
| # existing commodity with greater precision
 | |
|  printf '2010/1/1\n a  $1000.00\n b\n' >add-default-commodity-$$.j; hledger -fadd-default-commodity-$$.j add >/dev/null; cat add-default-commodity-$$.j; rm -f add-default-commodity-$$.j
 | |
| <<<
 | |
| 
 | |
| 
 | |
| a
 | |
| $1000.0
 | |
| b
 | |
| 
 | |
| .
 | |
| >>> /a  +\$1000\.0/
 | |
| #
 | |
| # existing commodity with less precision
 | |
|  printf '2010/1/1\n a  $1000.0\n b\n' >add-default-commodity-$$.j; hledger -fadd-default-commodity-$$.j add >/dev/null; cat add-default-commodity-$$.j; rm -f add-default-commodity-$$.j
 | |
| <<<
 | |
| 
 | |
| 
 | |
| a
 | |
| $1000.00
 | |
| b
 | |
| 
 | |
| .
 | |
| >>> /a  +\$1000\.00/
 | |
| #
 | |
| # no commodity entered, the (most recent) default commodity should be applied
 | |
|  printf 'D $1000.0\nD £1,000.00\n' >add-default-commodity-$$.j; hledger -fadd-default-commodity-$$.j add; cat add-default-commodity-$$.j; rm -f add-default-commodity-$$.j
 | |
| <<<
 | |
| 2010/1/1
 | |
| 
 | |
| a
 | |
| 1000
 | |
| b
 | |
| 
 | |
| .
 | |
| >>> /a  +£1,000.00/
 | |
| # default amounts should not fail to balance due to precision
 | |
| bin/hledger -f nosuch.journal add
 | |
| <<<
 | |
| 2010/1/1
 | |
| x
 | |
| a
 | |
| 0.25
 | |
| b
 | |
| 0.5
 | |
| c
 | |
| >>> /amount  3 \[-0.75\]/
 |