* Remember original postings during infer and pivot This includes such functions like: - inferFromAssignment - inferBalancingAmount - inferBalancingPrices - pivotPosting * Use original postings for hledger print - Introduce "--explicit" option for "print" command which brings back old behavior when every inferred number being printed. - Make "print" by default print original postings without inferred amounts. But use effective account name to have effect from aliases. - Instruct shell tests with an new expected output or to use --explicit option when inferred amounts are checked. Resolves simonmichael/hledger#442
		
			
				
	
	
		
			124 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			124 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| # alias-related tests
 | |
| 
 | |
| # simple aliases
 | |
| 
 | |
| # simple alias directive
 | |
| hledger -f- accounts
 | |
| <<<
 | |
| alias checking = assets:bank:checking
 | |
| 1/1
 | |
|     (checking:a)  1
 | |
| >>>
 | |
| assets:bank:checking:a
 | |
| >>>=0
 | |
| 
 | |
| # simple alias matches whole account name components only
 | |
| hledger -f- accounts
 | |
| <<<
 | |
| alias a:b = A:B
 | |
| 1/1
 | |
|     (a:b:c)   1  ; should match this
 | |
| 1/1
 | |
|     (a:bb:d)  1  ; should not match this
 | |
| >>>
 | |
| A:B:c
 | |
| a:bb:d
 | |
| >>>=0
 | |
| 
 | |
| # a simple alias matching the whole account name works
 | |
| hledger -f- accounts
 | |
| <<<
 | |
| alias a:b = A:B
 | |
| 1/1
 | |
|     (a:b)   1
 | |
| >>>
 | |
| A:B
 | |
| >>>=0
 | |
| 
 | |
| # regular expression aliases
 | |
| 
 | |
| # regex alias directive
 | |
| hledger -f- accounts
 | |
| <<<
 | |
| alias /^(.+):bank:([^:]+):?(.*)/ = \1:\2 \3
 | |
| 1/1
 | |
|     (assets:bank:B:checking:a)  1
 | |
| >>>
 | |
| assets:B checking:a
 | |
| >>>=0
 | |
| 
 | |
| # regex alias pattern is a case-insensitive regular expression
 | |
| # matching anywhere in the account name. All matching aliases are
 | |
| # applied to an account name in turn, most recently seen first. The
 | |
| # replacement can replace multiple matches within the account name.
 | |
| # The replacement pattern supports numeric backreferences.
 | |
| #
 | |
| hledger -f- print
 | |
| <<<
 | |
| alias /a/ = b
 | |
| 
 | |
| 2011/01/01
 | |
|     A a  1
 | |
|     a a  2
 | |
|     c
 | |
| 
 | |
| alias /A (.)/=\1
 | |
| 
 | |
| 2011/01/01
 | |
|     A a  1
 | |
|     a a  2
 | |
|     c
 | |
| 
 | |
| >>>
 | |
| 2011/01/01
 | |
|     b b             1
 | |
|     b b             2
 | |
|     c
 | |
| 
 | |
| 2011/01/01
 | |
|     b             1
 | |
|     b             2
 | |
|     c
 | |
| 
 | |
| >>>=0
 | |
| 
 | |
| # CLI
 | |
| 
 | |
| # --alias command-line options are applied in the order written.
 | |
| # Spaces are allowed if quoted.
 | |
| # 
 | |
| hledger -f- print --alias '/A (.)/=a' --alias /a/=b
 | |
| <<<
 | |
| 2011/01/01
 | |
|     a a  1
 | |
|     A a  2
 | |
|     c
 | |
| 
 | |
| >>>
 | |
| 2011/01/01
 | |
|     b             1
 | |
|     b             2
 | |
|     c
 | |
| 
 | |
| >>>=0
 | |
| 
 | |
| # alias options are applied after alias directives.
 | |
| #
 | |
| hledger -f- print --alias /a/=A --alias /B/=C --alias /B/=D --alias /C/=D
 | |
| <<<
 | |
| alias /^a/=B
 | |
| alias /^a/=E
 | |
| alias E=F
 | |
| 
 | |
| 2011/01/01
 | |
|     [a:x]    1
 | |
|     [x:a:x]
 | |
| 
 | |
| >>>
 | |
| 2011/01/01
 | |
|     [E:x]             1
 | |
|     [x:A:x]
 | |
| 
 | |
| >>>2
 | |
| >>>=0
 |