217 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Org Mode
		
	
	
	
	
	
			
		
		
	
	
			217 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Org Mode
		
	
	
	
	
	
* Tests for hledger-ui
 | 
						|
 | 
						|
When you want to check that hledger-ui is working correctly, 
 | 
						|
run through the following tests, by hand, in an 80x25 terminal. 
 | 
						|
Each test gives a command to run in this directory, and the first
 | 
						|
few lines of expected output (and any notes as a # comment).
 | 
						|
 | 
						|
Once you're familiar with the tests, you can view this file in Emacs
 | 
						|
org mode (eg) with all body text folded, showing just the test steps
 | 
						|
and brief expected result.
 | 
						|
 | 
						|
Another source of tests is the tutorial at https://hledger.org/ui.html,
 | 
						|
which has nice screenshots, but might be less up to date.
 | 
						|
 | 
						|
** hledger-ui -f sample.journal  # shows all accounts in list mode
 | 
						|
───────────────────── sample.journal account balances (1/8) ────────────────────
 | 
						|
 assets:bank:checking    0  # <- selected
 | 
						|
 assets:bank:saving     $1
 | 
						|
 assets:cash           $-2
 | 
						|
 expenses:food          $1
 | 
						|
 expenses:supplies      $1
 | 
						|
 income:gifts          $-1
 | 
						|
 income:salary         $-1
 | 
						|
 liabilities:debts      $1
 | 
						|
 | 
						|
** t  # switches to tree mode
 | 
						|
──────────────────── sample.journal account balances (3/13) ────────────────────
 | 
						|
 assets       $-1
 | 
						|
  bank         $1
 | 
						|
   checking     0  # <- selected
 | 
						|
   saving      $1
 | 
						|
  cash        $-2
 | 
						|
 expenses      $2
 | 
						|
  food         $1
 | 
						|
  supplies     $1
 | 
						|
 income       $-2
 | 
						|
  gifts       $-1
 | 
						|
  salary      $-1
 | 
						|
 liabilities   $1
 | 
						|
  debts        $1
 | 
						|
 | 
						|
** 1  # clips accounts to depth 1
 | 
						|
─────────────── sample.journal account balances to depth 1 (1/4) ───────────────
 | 
						|
 assets       $-1  # <- selected
 | 
						|
 expenses      $2
 | 
						|
 income       $-2
 | 
						|
 liabilities   $1
 | 
						|
 | 
						|
** RIGHT  # shows assets & subaccounts' transactions (register ignores depth limit)
 | 
						|
─────────────────────────── assets transactions (5/5) ──────────────────────────
 | 
						|
 2008-01-01   income                     in:salary                     $1    $1
 | 
						|
 2008-06-01   gift                       in:gifts                      $1    $2
 | 
						|
 2008-06-02   save                       as:ba:saving, as:ba:chec..     0    $2
 | 
						|
 2008-06-03 * eat & shop                 ex:food, ex:supplies         $-2     0
 | 
						|
 2008-12-31 * pay off                    li:debts                     $-1   $-1  # <- selected
 | 
						|
 | 
						|
** ESC  # reset UI state to initial screen in list mode
 | 
						|
───────────────────── sample.journal account balances (1/8) ────────────────────
 | 
						|
 assets:bank:checking    0  # <- selected
 | 
						|
 assets:bank:saving     $1
 | 
						|
 assets:cash           $-2
 | 
						|
 expenses:food          $1
 | 
						|
 expenses:supplies      $1
 | 
						|
 income:gifts          $-1
 | 
						|
 income:salary         $-1
 | 
						|
 liabilities:debts      $1
 | 
						|
 | 
						|
** / bank  # set a filter, showing only accounts with "bank" in the name
 | 
						|
────────────── sample.journal account balances matching bank (1/2) ─────────────
 | 
						|
 assets:bank:checking   0  # <- selected
 | 
						|
 assets:bank:saving    $1
 | 
						|
 | 
						|
** RIGHT  # shows assets:bank:checking & subaccounts' transactions
 | 
						|
───────────── assets:bank:checking transactions matching bank (4/4) ────────────
 | 
						|
 2008-01-01   income                      in:salary                     $1   $1
 | 
						|
 2008-06-01   gift                        in:gifts                      $1   $2
 | 
						|
 2008-06-02   save                        as:ba:saving                 $-1   $1
 | 
						|
 2008-12-31 * pay off                     li:debts                     $-1    0  # <- selected
 | 
						|
 | 
						|
** / SPACE desc:a  # add another filter term, showing only transactions with "a" in the description
 | 
						|
───────── assets:bank:checking transactions matching bank desc:a (2/2) ─────────
 | 
						|
 2008-06-02   save                       as:ba:saving                 $-1   $-1
 | 
						|
 2008-12-31 * pay off                    as:ba:checking               $-1   $-2  # <- selected
 | 
						|
 | 
						|
** RIGHT  # shows transaction detail
 | 
						|
───── Transaction #5 (2 of 2 matching bank desc:a in assets:bank:checking) ─────
 | 
						|
 2008-12-31 * pay off
 | 
						|
     liabilities:debts                 $1
 | 
						|
     assets:bank:checking             $-1
 | 
						|
 | 
						|
** UP  # shows previous matched transaction
 | 
						|
───── Transaction #3 (1 of 2 matching bank desc:a in assets:bank:checking) ─────
 | 
						|
 2008-06-02 save
 | 
						|
     assets:bank:saving                $1
 | 
						|
     assets:bank:checking             $-1
 | 
						|
 | 
						|
** DOWN  # shows next matched transaction
 | 
						|
───── Transaction #5 (2 of 2 matching bank desc:a in assets:bank:checking) ─────
 | 
						|
 2008-12-31 * pay off
 | 
						|
     liabilities:debts                 $1
 | 
						|
     assets:bank:checking             $-1
 | 
						|
 | 
						|
** ?  # shows help dialog over current screen; all content fits unclipped in 80x25, including the last q quit line
 | 
						|
┌──────────────────────Help (LEFT/ESC/?/q to close help)──────────────────────┐─
 | 
						|
│ Navigation                             Filtering                            │
 | 
						|
│ UP/DOWN/PUP/PDN/HOME/END/k/j/C-p/C-n   /    set a filter query              │
 | 
						|
│      move selection up/down            F    show future & periodic txns     │
 | 
						|
│ RIGHT/l/C-f show txns, or txn detail   R    show real/all postings          │
 | 
						|
│ LEFT/h/C-b  go back                    Z    show nonzero/all amounts        │
 | 
						|
│ ESC  cancel, or reset app state        U/P/C  show unmarked/pending/cleared │
 | 
						|
│                                        S-DOWN /S-UP   shrink/grow period    │
 | 
						|
│ Accounts screen                        S-RIGHT/S-LEFT next/previous period  │
 | 
						|
│ 1234567890-+  set/adjust depth limit   T              set period to today   │
 | 
						|
│ t  toggle accounts tree/list mode      DEL  reset filters                   │
 | 
						|
│ H  toggle historical balance/change                                         │
 | 
						|
│                                        Other                                │
 | 
						|
│ Register screen                        a    add transaction (hledger add)   │
 | 
						|
│ t  toggle subaccount txns              A    add transaction (hledger-iadd)  │
 | 
						|
│    (and accounts tree/list mode)       B    show amounts/costs              │
 | 
						|
│ H  toggle historical/period total      E    open editor                     │
 | 
						|
│                                        I    toggle balance assertions       │
 | 
						|
│ Help                                   V    show amounts/market values      │
 | 
						|
│ ?     toggle this help                 g    reload data                     │
 | 
						|
│ p/m/i while help is open:              C-l  redraw & recenter               │
 | 
						|
│       show manual in pager/man/info    C-z  suspend                         │
 | 
						|
│                                        q    quit                            │
 | 
						|
└─────────────────────────────────────────────────────────────────────────────┘
 | 
						|
──── ?:help t:list/tree -+:depth H:end-bals/changes F:forecast a:add q:quit ────
 | 
						|
 | 
						|
** q  # q with help dialog open closes it
 | 
						|
──── Transaction #5 (1 of 1 matching bank desc:pay in assets:bank:checking) ────
 | 
						|
 2008-12-31 * pay off
 | 
						|
     liabilities:debts                 $1
 | 
						|
     assets:bank:checking             $-1
 | 
						|
 | 
						|
** q  # q elsewhere exits the app, terminal is restored to its previous state
 | 
						|
~/src/hledger/hledger-ui/test$ hledger-ui -f sample.journal
 | 
						|
~/src/hledger/hledger-ui/test$ 
 | 
						|
 | 
						|
** hledger-ui -f sample.journal --register checking date:200812  # date query at startup
 | 
						|
──── assets:bank:checking transactions matching date:200812 in 2008-12 (1/1) ───
 | 
						|
 2008-12-31 * pay off                     li:debts                      $-1   0  # <- selected
 | 
						|
 | 
						|
** hledger-ui -f sample.journal --register checking date:200812 --change  # total is now $-1
 | 
						|
──── assets:bank:checking transactions matching date:200812 in 2008-12 (1/1) ───
 | 
						|
 2008-12-31 * pay off                    li:debts                     $-1   $-1
 | 
						|
 | 
						|
** hledger-ui -f bcexample.journal --tree --register assets  # wide content is elided as shown
 | 
						|
───────────────────────── Assets transactions (518/518) ────────────────────────
 | 
						|
 2014-07-26 * ..  ..      16.00 GLD, -1515.83 USD   ..GLD, 17.00 ITOT, 6 more..
 | 
						|
 2014-07-31 * ..  ..      2550.60 USD, 4.62 VACHR   ..GLD, 17.00 ITOT, 6 more..
 | 
						|
 2014-08-03 * ..  ..                 -2400.00 USD   ..GLD, 17.00 ITOT, 6 more..
 | 
						|
 | 
						|
** hledger-ui --today 2021-09-01 -f forecast.journal --register a   # future and forecasted txns are hidden by default
 | 
						|
───────────────────────────── a transactions (1/1) ─────────────────────────────
 | 
						|
 0000-01-01   past transaction             a                              1   1
 | 
						|
 | 
						|
** hledger-ui --today 2021-09-01 -f forecast.journal --register a --forecast  # with --forecast, future ordinary txns, and forecasted txns within the default forecast period, are shown
 | 
						|
───────────────────────────── a transactions (1/4) ─────────────────────────────
 | 
						|
 2020-01-01   past transaction             a                              1   1
 | 
						|
 2021-12-31   near future transaction      a                              2   3
 | 
						|
 2022-01-01   near future forecast tran..  a                              3   6
 | 
						|
 2022-02-01   near future forecast tran..  a                              3   9
 | 
						|
 | 
						|
** hledger-ui --today 2021-09-01 -f forecast.journal --register a --forecast 2021  # "=" is required between --forecast and its argument
 | 
						|
───────────────────── a transactions matching 2021 (100/0) ─────────────────────
 | 
						|
 | 
						|
** hledger-ui --today 2021-09-01 -f forecast.journal --register a --forecast=2021  # the forecast period can be specified, and this allows forecast txns to overlap ordinary transactions
 | 
						|
──────────────────────────── a transactions (14/14) ────────────────────────────
 | 
						|
 2020-01-01   past transaction             a                             1    1
 | 
						|
 2021-01-01   near future forecast tran..  a                             3    4
 | 
						|
 2021-02-01   near future forecast tran..  a                             3    7
 | 
						|
 2021-03-01   near future forecast tran..  a                             3   10
 | 
						|
 2021-04-01   near future forecast tran..  a                             3   13
 | 
						|
 2021-05-01   near future forecast tran..  a                             3   16
 | 
						|
 2021-06-01   near future forecast tran..  a                             3   19
 | 
						|
 2021-07-01   near future forecast tran..  a                             3   22
 | 
						|
 2021-08-01   near future forecast tran..  a                             3   25
 | 
						|
 2021-09-01   near future forecast tran..  a                             3   28
 | 
						|
 2021-10-01   near future forecast tran..  a                             3   31
 | 
						|
 2021-11-01   near future forecast tran..  a                             3   34
 | 
						|
 2021-12-01   near future forecast tran..  a                             3   37
 | 
						|
 2021-12-31   near future transaction      a                             2   39
 | 
						|
 | 
						|
** press F four times  # the future & forecasted txns are toggled every time (#1411)
 | 
						|
 | 
						|
** hledger-ui --today 2021-09-01 -f forecast.journal --register a --forecast=2021 --watch, press F once  # future/forecasted txns are hidden
 | 
						|
───────────────────────────── a transactions (1/1) ─────────────────────────────
 | 
						|
 2020-01-01   past transaction             a                              1   1
 | 
						|
 | 
						|
** with the above still running, touch forecast.journal, press F again  # forecast txns reappear, even with file modified while hidden (#1204)
 | 
						|
───────────────────────────── a transactions (1/14) ────────────────────────────
 | 
						|
 2020-01-01   past transaction             a                             1    1  # <- selected 
 | 
						|
 2021-01-01   near future forecast tran..  a                             3    4
 | 
						|
 2021-02-01   near future forecast tran..  a                             3    7
 | 
						|
 2021-03-01   near future forecast tran..  a                             3   10
 | 
						|
 2021-04-01   near future forecast tran..  a                             3   13
 | 
						|
 2021-05-01   near future forecast tran..  a                             3   16
 | 
						|
 2021-06-01   near future forecast tran..  a                             3   19
 | 
						|
 2021-07-01   near future forecast tran..  a                             3   22
 | 
						|
 2021-08-01   near future forecast tran..  a                             3   25
 | 
						|
 2021-09-01   near future forecast tran..  a                             3   28
 | 
						|
 2021-10-01   near future forecast tran..  a                             3   31
 | 
						|
 2021-11-01   near future forecast tran..  a                             3   34
 | 
						|
 2021-12-01   near future forecast tran..  a                             3   37
 | 
						|
 2021-12-31   near future transaction      a                             2   39
 | 
						|
 | 
						|
** hledger-ui -f 1468.j, 2, RIGHT  # in list mode, register of account above depth limit shows only its transactions
 | 
						|
───────────────────────────── a transactions (1/1) ─────────────────────────────
 | 
						|
 2021-01-01                                a                              1   1
 | 
						|
 | 
						|
** LEFT, DOWN, RIGHT  # in list mode, register of account at depth limit also shows subaccounts' transactions (#1468)
 | 
						|
──────────────────────────── a:aa transactions (2/2) ───────────────────────────
 | 
						|
 2021-01-02                              a:aa                          10    10
 | 
						|
 2021-01-03                              a:aa:aaa                     100   110
 | 
						|
 |