require some postings in ledger transactions

This commit is contained in:
Simon Michael 2009-04-10 05:00:51 +00:00
parent 0b22774ec9
commit 5d1f535b5e
2 changed files with 3 additions and 1 deletions

View File

@ -362,7 +362,7 @@ ledgercode :: GenParser Char st String
ledgercode = try (do { char '('; code <- anyChar `manyTill` char ')'; many1 spacenonewline; return code } ) <|> return ""
ledgerpostings :: GenParser Char LedgerFileCtx [Posting]
ledgerpostings = many $ try ledgerposting
ledgerpostings = many1 $ try ledgerposting
ledgerposting :: GenParser Char LedgerFileCtx Posting
ledgerposting = many1 spacenonewline >> choice [ normalposting, virtualposting, balancedvirtualposting ]

View File

@ -562,6 +562,8 @@ tests = [
parseWithCtx ledgerTransaction entry1_str `parseis` entry1
assertBool "ledgerTransaction should not parse just a date"
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1\n"
assertBool "ledgerTransaction should require some postings"
$ isLeft $ parseWithCtx ledgerTransaction "2009/1/1 a\n"
,"ledgerHistoricalPrice" ~: do
parseWithCtx ledgerHistoricalPrice price1_str `parseis` price1