reindent tests, now using haskell-indentation.el
This commit is contained in:
parent
9957335f9c
commit
84e093fff1
63
Tests.hs
63
Tests.hs
@ -17,15 +17,14 @@ tconcat :: [Test] -> Test
|
|||||||
tconcat = foldr (\(TestList as) (TestList bs) -> TestList (as ++ bs)) (TestList [])
|
tconcat = foldr (\(TestList as) (TestList bs) -> TestList (as ++ bs)) (TestList [])
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
unittests = TestList
|
|
||||||
-- NB assertequal arguments on a new line have to be indented at least
|
unittests = TestList [
|
||||||
-- one space, contrary to haskell-mode's auto indent
|
-- remember to indent assertequal arguments, contrary to haskell-mode auto-indent
|
||||||
[
|
|
||||||
"show dollars" ~: show (dollars 1) ~?= "$1.00"
|
"show dollars" ~: show (dollars 1) ~?= "$1.00"
|
||||||
|
,
|
||||||
,"show hours" ~: show (hours 1) ~?= "1.0h"
|
"show hours" ~: show (hours 1) ~?= "1.0h"
|
||||||
|
,
|
||||||
,"amount arithmetic" ~: do
|
"amount arithmetic" ~: do
|
||||||
let a1 = dollars 1.23
|
let a1 = dollars 1.23
|
||||||
let a2 = Amount (comm "$") (-1.23)
|
let a2 = Amount (comm "$") (-1.23)
|
||||||
let a3 = Amount (comm "$") (-1.23)
|
let a3 = Amount (comm "$") (-1.23)
|
||||||
@ -36,51 +35,51 @@ unittests = TestList
|
|||||||
assertequal (Amount (comm "$") (-2.46)) (sum [a2,a3])
|
assertequal (Amount (comm "$") (-2.46)) (sum [a2,a3])
|
||||||
assertequal (Amount (comm "$") (-2.46)) (sum [a3,a3])
|
assertequal (Amount (comm "$") (-2.46)) (sum [a3,a3])
|
||||||
assertequal (Amount (comm "$") 0) (sum [a1,a2,a3,-a3])
|
assertequal (Amount (comm "$") 0) (sum [a1,a2,a3,-a3])
|
||||||
|
,
|
||||||
,"ledgertransaction" ~: do
|
"ledgertransaction" ~: do
|
||||||
assertparseequal rawtransaction1 (parsewith ledgertransaction rawtransaction1_str)
|
assertparseequal rawtransaction1 (parsewith ledgertransaction rawtransaction1_str)
|
||||||
|
,
|
||||||
,"ledgerentry" ~: do
|
"ledgerentry" ~: do
|
||||||
assertparseequal entry1 (parsewith ledgerentry entry1_str)
|
assertparseequal entry1 (parsewith ledgerentry entry1_str)
|
||||||
|
,
|
||||||
,"autofillEntry" ~: do
|
"autofillEntry" ~: do
|
||||||
assertequal
|
assertequal
|
||||||
(dollars (-47.18))
|
(dollars (-47.18))
|
||||||
(tamount $ last $ etransactions $ autofillEntry entry1)
|
(tamount $ last $ etransactions $ autofillEntry entry1)
|
||||||
|
,
|
||||||
,"punctuatethousands" ~: punctuatethousands "" @?= ""
|
"punctuatethousands" ~: punctuatethousands "" @?= ""
|
||||||
,"punctuatethousands" ~: punctuatethousands "1234567.8901" @?= "1,234,567.8901"
|
,
|
||||||
,"punctuatethousands" ~: punctuatethousands "-100" @?= "-100"
|
"punctuatethousands" ~: punctuatethousands "1234567.8901" @?= "1,234,567.8901"
|
||||||
|
,
|
||||||
,"expandAccountNames" ~: do
|
"punctuatethousands" ~: punctuatethousands "-100" @?= "-100"
|
||||||
|
,
|
||||||
|
"expandAccountNames" ~: do
|
||||||
assertequal
|
assertequal
|
||||||
["assets","assets:cash","assets:checking","expenses","expenses:vacation"]
|
["assets","assets:cash","assets:checking","expenses","expenses:vacation"]
|
||||||
(expandAccountNames ["assets:cash","assets:checking","expenses:vacation"])
|
(expandAccountNames ["assets:cash","assets:checking","expenses:vacation"])
|
||||||
|
,
|
||||||
,"ledgerAccountNames" ~: do
|
"ledgerAccountNames" ~: do
|
||||||
assertequal
|
assertequal
|
||||||
["assets","assets:cash","assets:checking","assets:saving","equity","equity:opening balances",
|
["assets","assets:cash","assets:checking","assets:saving","equity","equity:opening balances",
|
||||||
"expenses","expenses:food","expenses:food:dining","expenses:phone","expenses:vacation",
|
"expenses","expenses:food","expenses:food:dining","expenses:phone","expenses:vacation",
|
||||||
"liabilities","liabilities:credit cards","liabilities:credit cards:discover"]
|
"liabilities","liabilities:credit cards","liabilities:credit cards:discover"]
|
||||||
(accountnames ledger7)
|
(accountnames ledger7)
|
||||||
|
,
|
||||||
,"cacheLedger" ~: do
|
"cacheLedger" ~: do
|
||||||
assertequal 15 (length $ Map.keys $ accountmap $ cacheLedger rawledger7 )
|
assertequal 15 (length $ Map.keys $ accountmap $ cacheLedger rawledger7)
|
||||||
|
,
|
||||||
,"transactionamount" ~: do
|
"transactionamount" ~: do
|
||||||
assertparseequal (dollars 47.18) (parsewith transactionamount " $47.18")
|
assertparseequal (dollars 47.18) (parsewith transactionamount " $47.18")
|
||||||
assertparseequal (Amount (Commodity {symbol="$",side=L,spaced=False,comma=False,precision=0,rate=1}) 1) (parsewith transactionamount " $1.")
|
assertparseequal (Amount (Commodity {symbol="$",side=L,spaced=False,comma=False,precision=0,rate=1}) 1) (parsewith transactionamount " $1.")
|
||||||
]
|
]
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
functests = TestList
|
|
||||||
[
|
functests = TestList [
|
||||||
balancecommandtests
|
balancecommandtests
|
||||||
]
|
]
|
||||||
|
|
||||||
balancecommandtests =
|
balancecommandtests = TestList [
|
||||||
TestList
|
|
||||||
[
|
|
||||||
"simple balance report" ~: do
|
"simple balance report" ~: do
|
||||||
l <- ledgerfromfile "sample.ledger"
|
l <- ledgerfromfile "sample.ledger"
|
||||||
assertequal
|
assertequal
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user