convert multi-line strings to non-slash style for now so I can use sp to auto-build
This commit is contained in:
		
							parent
							
								
									c46189a75b
								
							
						
					
					
						commit
						f831064644
					
				
							
								
								
									
										16
									
								
								Options.hs
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								Options.hs
									
									
									
									
									
								
							| @ -8,14 +8,14 @@ import Ledger.AccountName (negativepatternchar) | |||||||
| 
 | 
 | ||||||
| usagehdr    = "Usage: hledger [OPTS] balance|print|register [ACCTPATS] [-- DESCPATS]\n\nOptions"++warning++":" | usagehdr    = "Usage: hledger [OPTS] balance|print|register [ACCTPATS] [-- DESCPATS]\n\nOptions"++warning++":" | ||||||
| warning     = if negativepatternchar=='-' then " (must appear before command)" else " (can appear anywhere)" | warning     = if negativepatternchar=='-' then " (must appear before command)" else " (can appear anywhere)" | ||||||
| usageftr    = "\n\ | usageftr    = "\n" ++ | ||||||
|               \Commands (may be abbreviated):\n\ |               "Commands (may be abbreviated):\n" ++ | ||||||
|               \balance  - show account balances\n\ |               "balance  - show account balances\n" ++ | ||||||
|               \print    - show parsed and reformatted ledger entries\n\ |               "print    - show parsed and reformatted ledger entries\n" ++ | ||||||
|               \register - show register transactions\n\ |               "register - show register transactions\n" ++ | ||||||
|               \\n\ |               "\n" ++ | ||||||
|               \Account and description patterns are regular expressions, optionally prefixed\n\ |               "Account and description patterns are regular expressions, optionally prefixed\n" ++ | ||||||
|               \with " ++ [negativepatternchar] ++ " to make them negative.\n" |               "with " ++ [negativepatternchar] ++ " to make them negative.\n" | ||||||
| defaultfile = "~/.ledger" | defaultfile = "~/.ledger" | ||||||
| fileenvvar  = "LEDGER" | fileenvvar  = "LEDGER" | ||||||
| optionorder = if negativepatternchar=='-' then RequireOrder else Permute | optionorder = if negativepatternchar=='-' then RequireOrder else Permute | ||||||
|  | |||||||
							
								
								
									
										358
									
								
								Tests.hs
									
									
									
									
									
								
							
							
						
						
									
										358
									
								
								Tests.hs
									
									
									
									
									
								
							| @ -122,96 +122,96 @@ balancereportacctnames_tests = TestList | |||||||
| balancecommand_tests = TestList [ | balancecommand_tests = TestList [ | ||||||
|   "simple balance report" ~: do |   "simple balance report" ~: do | ||||||
|     l <- ledgerfromfile [] "sample.ledger" |     l <- ledgerfromfile [] "sample.ledger" | ||||||
|     assertequal |     assertequal ( | ||||||
|      "                 $-1  assets\n\ |      "                 $-1  assets\n" ++ | ||||||
|      \                  $2  expenses\n\ |      "                  $2  expenses\n" ++ | ||||||
|      \                 $-2  income\n\ |      "                 $-2  income\n" ++ | ||||||
|      \                  $1  liabilities\n\ |      "                  $1  liabilities\n" ++ | ||||||
|      \" --" |      "") | ||||||
|      (showBalanceReport [] [] l) |      (showBalanceReport [] [] l) | ||||||
|  , |  , | ||||||
|   "balance report with --subtotal" ~: do |   "balance report with --subtotal" ~: do | ||||||
|     l <- ledgerfromfile [] "sample.ledger" |     l <- ledgerfromfile [] "sample.ledger" | ||||||
|     assertequal |     assertequal ( | ||||||
|      "                 $-1  assets\n\ |      "                 $-1  assets\n" ++ | ||||||
|      \                 $-2    cash\n\ |      "                 $-2    cash\n" ++ | ||||||
|      \                  $1    saving\n\ |      "                  $1    saving\n" ++ | ||||||
|      \                  $2  expenses\n\ |      "                  $2  expenses\n" ++ | ||||||
|      \                  $1    food\n\ |      "                  $1    food\n" ++ | ||||||
|      \                  $1    supplies\n\ |      "                  $1    supplies\n" ++ | ||||||
|      \                 $-2  income\n\ |      "                 $-2  income\n" ++ | ||||||
|      \                 $-1    gifts\n\ |      "                 $-1    gifts\n" ++ | ||||||
|      \                 $-1    salary\n\ |      "                 $-1    salary\n" ++ | ||||||
|      \                  $1  liabilities:debts\n\ |      "                  $1  liabilities:debts\n" ++ | ||||||
|      \" --" |      "") | ||||||
|      (showBalanceReport [SubTotal] [] l) |      (showBalanceReport [SubTotal] [] l) | ||||||
|  , |  , | ||||||
|   "balance report with account pattern o" ~: do |   "balance report with account pattern o" ~: do | ||||||
|     l <- ledgerfromfile ["o"] "sample.ledger" |     l <- ledgerfromfile ["o"] "sample.ledger" | ||||||
|     assertequal |     assertequal ( | ||||||
|      "                  $1  expenses:food\n\ |      "                  $1  expenses:food\n" ++ | ||||||
|      \                 $-2  income\n\ |      "                 $-2  income\n" ++ | ||||||
|      \--------------------\n\ |      "--------------------\n" ++ | ||||||
|      \                 $-1\n\ |      "                 $-1\n" ++ | ||||||
|      \" --" |      "") | ||||||
|      (showBalanceReport [] ["o"] l) |      (showBalanceReport [] ["o"] l) | ||||||
|  , |  , | ||||||
|   "balance report with account pattern o and --subtotal" ~: do |   "balance report with account pattern o and --subtotal" ~: do | ||||||
|     l <- ledgerfromfile ["o"] "sample.ledger" |     l <- ledgerfromfile ["o"] "sample.ledger" | ||||||
|     assertequal |     assertequal ( | ||||||
|      "                  $1  expenses:food\n\ |      "                  $1  expenses:food\n" ++ | ||||||
|      \                 $-2  income\n\ |      "                 $-2  income\n" ++ | ||||||
|      \                 $-1    gifts\n\ |      "                 $-1    gifts\n" ++ | ||||||
|      \                 $-1    salary\n\ |      "                 $-1    salary\n" ++ | ||||||
|      \--------------------\n\ |      "--------------------\n" ++ | ||||||
|      \                 $-1\n\ |      "                 $-1\n" ++ | ||||||
|      \" --" |      "") | ||||||
|      (showBalanceReport [SubTotal] ["o"] l) |      (showBalanceReport [SubTotal] ["o"] l) | ||||||
|  , |  , | ||||||
|   "balance report with account pattern a" ~: do |   "balance report with account pattern a" ~: do | ||||||
|     l <- ledgerfromfile ["a"] "sample.ledger" |     l <- ledgerfromfile ["a"] "sample.ledger" | ||||||
|     assertequal |     assertequal ( | ||||||
|      "                 $-1  assets\n\ |      "                 $-1  assets\n" ++ | ||||||
|      \                 $-2    cash\n\ |      "                 $-2    cash\n" ++ | ||||||
|      \                  $1    saving\n\ |      "                  $1    saving\n" ++ | ||||||
|      \                 $-1  income:salary\n\ |      "                 $-1  income:salary\n" ++ | ||||||
|      \                  $1  liabilities\n\ |      "                  $1  liabilities\n" ++ | ||||||
|      \--------------------\n\ |      "--------------------\n" ++ | ||||||
|      \                 $-1\n\ |      "                 $-1\n" ++ | ||||||
|      \" --" |      "") | ||||||
|      (showBalanceReport [] ["a"] l) |      (showBalanceReport [] ["a"] l) | ||||||
|  , |  , | ||||||
|   "balance report with account pattern e" ~: do |   "balance report with account pattern e" ~: do | ||||||
|     l <- ledgerfromfile ["e"] "sample.ledger" |     l <- ledgerfromfile ["e"] "sample.ledger" | ||||||
|     assertequal |     assertequal ( | ||||||
|      "                 $-1  assets\n\ |      "                 $-1  assets\n" ++ | ||||||
|      \                  $2  expenses\n\ |      "                  $2  expenses\n" ++ | ||||||
|      \                  $1    supplies\n\ |      "                  $1    supplies\n" ++ | ||||||
|      \                 $-2  income\n\ |      "                 $-2  income\n" ++ | ||||||
|      \                  $1  liabilities:debts\n\ |      "                  $1  liabilities:debts\n" ++ | ||||||
|      \" --" |      "") | ||||||
|      (showBalanceReport [] ["e"] l) |      (showBalanceReport [] ["e"] l) | ||||||
|  , |  , | ||||||
|   "balance report with unmatched parent of two matched subaccounts" ~:  |   "balance report with unmatched parent of two matched subaccounts" ~:  | ||||||
|   do |   do | ||||||
|     l <- ledgerfromfile ["cash","saving"] "sample.ledger" |     l <- ledgerfromfile ["cash","saving"] "sample.ledger" | ||||||
|     assertequal |     assertequal ( | ||||||
|      "                 $-2  assets:cash\n\ |      "                 $-2  assets:cash\n" ++ | ||||||
|      \                  $1  assets:saving\n\ |      "                  $1  assets:saving\n" ++ | ||||||
|      \--------------------\n\ |      "--------------------\n" ++ | ||||||
|      \                 $-1\n\ |      "                 $-1\n" ++ | ||||||
|      \" --" |      "") | ||||||
|      (showBalanceReport [] ["cash","saving"] l) |      (showBalanceReport [] ["cash","saving"] l) | ||||||
|  , |  , | ||||||
|   "balance report with multi-part account name" ~:  |   "balance report with multi-part account name" ~:  | ||||||
|   do  |   do  | ||||||
|     let pats = ["expenses:food"] |     let pats = ["expenses:food"] | ||||||
|     l <- ledgerfromfile pats "sample.ledger" |     l <- ledgerfromfile pats "sample.ledger" | ||||||
|     assertequal |     assertequal ( | ||||||
|      "                  $1  expenses:food\n\ |      "                  $1  expenses:food\n" ++ | ||||||
|      \--------------------\n\ |      "--------------------\n" ++ | ||||||
|      \                  $1\n\ |      "                  $1\n" ++ | ||||||
|      \" --" |      "") | ||||||
|      $ showBalanceReport [] pats l |      $ showBalanceReport [] pats l | ||||||
|  , |  , | ||||||
|   "balance report with negative account pattern" ~: do |   "balance report with negative account pattern" ~: do | ||||||
| @ -269,11 +269,11 @@ rawtransaction1_str  = "  expenses:food:dining  $10.00\n" | |||||||
| 
 | 
 | ||||||
| rawtransaction1 = RawTransaction "expenses:food:dining"(Mixed  [dollars 10]) "" RegularTransaction | rawtransaction1 = RawTransaction "expenses:food:dining"(Mixed  [dollars 10]) "" RegularTransaction | ||||||
| 
 | 
 | ||||||
| entry1_str = "\ | entry1_str = "" ++ | ||||||
| \2007/01/28 coopportunity\n\ |  "2007/01/28 coopportunity\n" ++ | ||||||
| \  expenses:food:groceries                 $47.18\n\ |  "  expenses:food:groceries                 $47.18\n" ++ | ||||||
| \  assets:checking\n\ |  "  assets:checking\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| entry1 = | entry1 = | ||||||
|     (Entry (parsedate "2007/01/28") False "" "coopportunity" "" |     (Entry (parsedate "2007/01/28") False "" "coopportunity" "" | ||||||
| @ -281,133 +281,133 @@ entry1 = | |||||||
|       RawTransaction "assets:checking" (Mixed [dollars (-47.18)]) "" RegularTransaction] "") |       RawTransaction "assets:checking" (Mixed [dollars (-47.18)]) "" RegularTransaction] "") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| entry2_str = "\ | entry2_str = "" ++ | ||||||
| \2007/01/27 * joes diner\n\ |  "2007/01/27 * joes diner\n" ++ | ||||||
| \  expenses:food:dining                    $10.00\n\ |  "  expenses:food:dining                    $10.00\n" ++ | ||||||
| \  expenses:gifts                          $10.00\n\ |  "  expenses:gifts                          $10.00\n" ++ | ||||||
| \  assets:checking                        $-20.00\n\ |  "  assets:checking                        $-20.00\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| entry3_str = "\ | entry3_str = "" ++ | ||||||
| \2007/01/01 * opening balance\n\ |  "2007/01/01 * opening balance\n" ++ | ||||||
| \    assets:cash                                $4.82\n\ |  "    assets:cash                                $4.82\n" ++ | ||||||
| \    equity:opening balances\n\ |  "    equity:opening balances\n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/01 * opening balance\n\ |  "2007/01/01 * opening balance\n" ++ | ||||||
| \    assets:cash                                $4.82\n\ |  "    assets:cash                                $4.82\n" ++ | ||||||
| \    equity:opening balances\n\ |  "    equity:opening balances\n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/28 coopportunity\n\ |  "2007/01/28 coopportunity\n" ++ | ||||||
| \  expenses:food:groceries                 $47.18\n\ |  "  expenses:food:groceries                 $47.18\n" ++ | ||||||
| \  assets:checking\n\ |  "  assets:checking\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| periodic_entry1_str = "\ | periodic_entry1_str = "" ++ | ||||||
| \~ monthly from 2007/2/2\n\ |  "~ monthly from 2007/2/2\n" ++ | ||||||
| \  assets:saving            $200.00\n\ |  "  assets:saving            $200.00\n" ++ | ||||||
| \  assets:checking\n\ |  "  assets:checking\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| periodic_entry2_str = "\ | periodic_entry2_str = "" ++ | ||||||
| \~ monthly from 2007/2/2\n\ |  "~ monthly from 2007/2/2\n" ++ | ||||||
| \  assets:saving            $200.00         ;auto savings\n\ |  "  assets:saving            $200.00         ;auto savings\n" ++ | ||||||
| \  assets:checking\n\ |  "  assets:checking\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| periodic_entry3_str = "\ | periodic_entry3_str = "" ++ | ||||||
| \~ monthly from 2007/01/01\n\ |  "~ monthly from 2007/01/01\n" ++ | ||||||
| \    assets:cash                                $4.82\n\ |  "    assets:cash                                $4.82\n" ++ | ||||||
| \    equity:opening balances\n\ |  "    equity:opening balances\n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \~ monthly from 2007/01/01\n\ |  "~ monthly from 2007/01/01\n" ++ | ||||||
| \    assets:cash                                $4.82\n\ |  "    assets:cash                                $4.82\n" ++ | ||||||
| \    equity:opening balances\n\ |  "    equity:opening balances\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| ledger1_str = "\ | ledger1_str = "" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/27 * joes diner\n\ |  "2007/01/27 * joes diner\n" ++ | ||||||
| \  expenses:food:dining                    $10.00\n\ |  "  expenses:food:dining                    $10.00\n" ++ | ||||||
| \  expenses:gifts                          $10.00\n\ |  "  expenses:gifts                          $10.00\n" ++ | ||||||
| \  assets:checking                        $-20.00\n\ |  "  assets:checking                        $-20.00\n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/28 coopportunity\n\ |  "2007/01/28 coopportunity\n" ++ | ||||||
| \  expenses:food:groceries                 $47.18\n\ |  "  expenses:food:groceries                 $47.18\n" ++ | ||||||
| \  assets:checking                        $-47.18\n\ |  "  assets:checking                        $-47.18\n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \" --" |  "" | ||||||
| 
 | 
 | ||||||
| ledger2_str = "\ | ledger2_str = "" ++ | ||||||
| \;comment\n\ |  ";comment\n" ++ | ||||||
| \2007/01/27 * joes diner\n\ |  "2007/01/27 * joes diner\n" ++ | ||||||
| \  expenses:food:dining                    $10.00\n\ |  "  expenses:food:dining                    $10.00\n" ++ | ||||||
| \  assets:checking                        $-47.18\n\ |  "  assets:checking                        $-47.18\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| ledger3_str = "\ | ledger3_str = "" ++ | ||||||
| \2007/01/27 * joes diner\n\ |  "2007/01/27 * joes diner\n" ++ | ||||||
| \  expenses:food:dining                    $10.00\n\ |  "  expenses:food:dining                    $10.00\n" ++ | ||||||
| \;intra-entry comment\n\ |  ";intra-entry comment\n" ++ | ||||||
| \  assets:checking                        $-47.18\n\ |  "  assets:checking                        $-47.18\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| ledger4_str = "\ | ledger4_str = "" ++ | ||||||
| \!include \"somefile\"\n\ |  "!include \"somefile\"\n" ++ | ||||||
| \2007/01/27 * joes diner\n\ |  "2007/01/27 * joes diner\n" ++ | ||||||
| \  expenses:food:dining                    $10.00\n\ |  "  expenses:food:dining                    $10.00\n" ++ | ||||||
| \  assets:checking                        $-47.18\n\ |  "  assets:checking                        $-47.18\n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| ledger5_str = "" | ledger5_str = "" | ||||||
| 
 | 
 | ||||||
| ledger6_str = "\ | ledger6_str = "" ++ | ||||||
| \~ monthly from 2007/1/21\n\ |  "~ monthly from 2007/1/21\n" ++ | ||||||
| \    expenses:entertainment  $16.23        ;netflix\n\ |  "    expenses:entertainment  $16.23        ;netflix\n" ++ | ||||||
| \    assets:checking\n\ |  "    assets:checking\n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \; 2007/01/01 * opening balance\n\ |  "; 2007/01/01 * opening balance\n" ++ | ||||||
| \;     assets:saving                            $200.04\n\ |  ";     assets:saving                            $200.04\n" ++ | ||||||
| \;     equity:opening balances                         \n\ |  ";     equity:opening balances                         \n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| ledger7_str = "\ | ledger7_str = "" ++ | ||||||
| \2007/01/01 * opening balance\n\ |  "2007/01/01 * opening balance\n" ++ | ||||||
| \    assets:cash                                $4.82\n\ |  "    assets:cash                                $4.82\n" ++ | ||||||
| \    equity:opening balances                         \n\ |  "    equity:opening balances                         \n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/01 * opening balance\n\ |  "2007/01/01 * opening balance\n" ++ | ||||||
| \    income:interest                                $-4.82\n\ |  "    income:interest                                $-4.82\n" ++ | ||||||
| \    equity:opening balances                         \n\ |  "    equity:opening balances                         \n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/02 * ayres suites\n\ |  "2007/01/02 * ayres suites\n" ++ | ||||||
| \    expenses:vacation                        $179.92\n\ |  "    expenses:vacation                        $179.92\n" ++ | ||||||
| \    assets:checking                                 \n\ |  "    assets:checking                                 \n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/02 * auto transfer to savings\n\ |  "2007/01/02 * auto transfer to savings\n" ++ | ||||||
| \    assets:saving                            $200.00\n\ |  "    assets:saving                            $200.00\n" ++ | ||||||
| \    assets:checking                                 \n\ |  "    assets:checking                                 \n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/03 * poquito mas\n\ |  "2007/01/03 * poquito mas\n" ++ | ||||||
| \    expenses:food:dining                       $4.82\n\ |  "    expenses:food:dining                       $4.82\n" ++ | ||||||
| \    assets:cash                                     \n\ |  "    assets:cash                                     \n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/03 * verizon\n\ |  "2007/01/03 * verizon\n" ++ | ||||||
| \    expenses:phone                            $95.11\n\ |  "    expenses:phone                            $95.11\n" ++ | ||||||
| \    assets:checking                                 \n\ |  "    assets:checking                                 \n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/03 * discover\n\ |  "2007/01/03 * discover\n" ++ | ||||||
| \    liabilities:credit cards:discover         $80.00\n\ |  "    liabilities:credit cards:discover         $80.00\n" ++ | ||||||
| \    assets:checking                                 \n\ |  "    assets:checking                                 \n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/04 * blue cross\n\ |  "2007/01/04 * blue cross\n" ++ | ||||||
| \    expenses:health:insurance                 $90.00\n\ |  "    expenses:health:insurance                 $90.00\n" ++ | ||||||
| \    assets:checking                                 \n\ |  "    assets:checking                                 \n" ++ | ||||||
| \\n\ |  "\n" ++ | ||||||
| \2007/01/05 * village market liquor\n\ |  "2007/01/05 * village market liquor\n" ++ | ||||||
| \    expenses:food:dining                       $6.48\n\ |  "    expenses:food:dining                       $6.48\n" ++ | ||||||
| \    assets:checking                                 \n\ |  "    assets:checking                                 \n" ++ | ||||||
| \\n" --" |  "\n" | ||||||
| 
 | 
 | ||||||
| rawledger7 = RawLedger | rawledger7 = RawLedger | ||||||
|           []  |           []  | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user