;lib: add 'payee' directive

This commit is contained in:
Damien Cassou 2020-12-29 20:33:57 +01:00 committed by Simon Michael
parent 8ab2316604
commit e092b38631

View File

@ -226,6 +226,7 @@ directivep = (do
,applyaccountdirectivep
,commoditydirectivep
,endapplyaccountdirectivep
,payeedirectivep
,tagdirectivep
,endtagdirectivep
,defaultyeardirectivep
@ -519,6 +520,14 @@ endtagdirectivep = do
lift restofline
return ()
payeedirectivep :: JournalParser m ()
payeedirectivep = do
string "payee" <?> "payee directive"
lift skipNonNewlineSpaces1
_ <- lift $ some nonspace
lift restofline
return ()
defaultyeardirectivep :: JournalParser m ()
defaultyeardirectivep = do
char 'Y' <?> "default year"
@ -985,6 +994,11 @@ tests_JournalReader = tests "JournalReader" [
pdamount = usd 922.83
}
,tests "payeedirectivep" [
test "simple" $ assertParse payeedirectivep "payee foo\n"
,test "with-comment" $ assertParse payeedirectivep "payee foo ; comment\n"
]
,test "tagdirectivep" $ do
assertParse tagdirectivep "tag foo \n"