require some postings in ledger transactions
This commit is contained in:
parent
0b22774ec9
commit
5d1f535b5e
@ -362,7 +362,7 @@ ledgercode :: GenParser Char st String
|
|||||||
ledgercode = try (do { char '('; code <- anyChar `manyTill` char ')'; many1 spacenonewline; return code } ) <|> return ""
|
ledgercode = try (do { char '('; code <- anyChar `manyTill` char ')'; many1 spacenonewline; return code } ) <|> return ""
|
||||||
|
|
||||||
ledgerpostings :: GenParser Char LedgerFileCtx [Posting]
|
ledgerpostings :: GenParser Char LedgerFileCtx [Posting]
|
||||||
ledgerpostings = many $ try ledgerposting
|
ledgerpostings = many1 $ try ledgerposting
|
||||||
|
|
||||||
ledgerposting :: GenParser Char LedgerFileCtx Posting
|
ledgerposting :: GenParser Char LedgerFileCtx Posting
|
||||||
ledgerposting = many1 spacenonewline >> choice [ normalposting, virtualposting, balancedvirtualposting ]
|
ledgerposting = many1 spacenonewline >> choice [ normalposting, virtualposting, balancedvirtualposting ]
|
||||||
|
|||||||
2
Tests.hs
2
Tests.hs
@ -562,6 +562,8 @@ tests = [
|
|||||||
parseWithCtx ledgerTransaction entry1_str `parseis` entry1
|
parseWithCtx ledgerTransaction entry1_str `parseis` entry1
|
||||||
assertBool "ledgerTransaction should not parse just a date"
|
assertBool "ledgerTransaction should not parse just a date"
|
||||||
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1\n"
|
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1\n"
|
||||||
|
assertBool "ledgerTransaction should require some postings"
|
||||||
|
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1 a\n"
|
||||||
|
|
||||||
,"ledgerHistoricalPrice" ~: do
|
,"ledgerHistoricalPrice" ~: do
|
||||||
parseWithCtx ledgerHistoricalPrice price1_str `parseis` price1
|
parseWithCtx ledgerHistoricalPrice price1_str `parseis` price1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user