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