tests: parsedate -> fromGregorian

This commit is contained in:
Simon Michael 2018-08-20 14:39:34 +01:00
parent 1190e2ae5d
commit be7866da59

View File

@ -623,7 +623,7 @@ easytests_JournalReader = tests "JournalReader" [
nullperiodictransaction { nullperiodictransaction {
ptperiodexpr = "monthly from 2018/6" ptperiodexpr = "monthly from 2018/6"
,ptinterval = Months 1 ,ptinterval = Months 1
,ptspan = DateSpan (Just $ parsedate "2018/06/01") Nothing ,ptspan = DateSpan (Just $ fromGregorian 2018 6 1) Nothing
,ptstatus = Unmarked ,ptstatus = Unmarked
,ptcode = "" ,ptcode = ""
,ptdescription = "" ,ptdescription = ""
@ -638,7 +638,7 @@ easytests_JournalReader = tests "JournalReader" [
nullperiodictransaction { nullperiodictransaction {
ptperiodexpr = "monthly from 2018/6" ptperiodexpr = "monthly from 2018/6"
,ptinterval = Months 1 ,ptinterval = Months 1
,ptspan = DateSpan (Just $ parsedate "2018/06/01") Nothing ,ptspan = DateSpan (Just $ fromGregorian 2018 6 1) Nothing
,ptdescription = "In 2019 we will change this\n" ,ptdescription = "In 2019 we will change this\n"
} }
@ -647,7 +647,7 @@ easytests_JournalReader = tests "JournalReader" [
nullperiodictransaction { nullperiodictransaction {
ptperiodexpr = "monthly from 2018/6" ptperiodexpr = "monthly from 2018/6"
,ptinterval = Months 1 ,ptinterval = Months 1
,ptspan = DateSpan (Just $ parsedate "2018/06/01") Nothing ,ptspan = DateSpan (Just $ fromGregorian 2018 6 1) Nothing
,ptdescription = "In 2019 we will change this\n" ,ptdescription = "In 2019 we will change this\n"
} }
@ -679,8 +679,8 @@ easytests_JournalReader = tests "JournalReader" [
,pamount=Mixed [num 1] ,pamount=Mixed [num 1]
,pcomment="date:2012/11/28, date2=2012/11/29,b:b\n" ,pcomment="date:2012/11/28, date2=2012/11/29,b:b\n"
,ptags=[("date", "2012/11/28"), ("date2=2012/11/29,b", "b")] -- TODO tag name parsed too greedily ,ptags=[("date", "2012/11/28"), ("date2=2012/11/29,b", "b")] -- TODO tag name parsed too greedily
,pdate=Just $ parsedate "2012/11/28" ,pdate=Just $ fromGregorian 2012 11 28
,pdate2=Nothing -- Just $ parsedate "2012/11/29" ,pdate2=Nothing -- Just $ fromGregorian 2012 11 29
} }
,test "posting dates bracket syntax" $ expectParseEq (postingp Nothing) ,test "posting dates bracket syntax" $ expectParseEq (postingp Nothing)
@ -711,7 +711,7 @@ easytests_JournalReader = tests "JournalReader" [
,tests "transactionp" [ ,tests "transactionp" [
test "just-a-date" $ expectParseEq transactionp "2015/1/1\n" nulltransaction{tdate=parsedate "2015/01/01"} test "just-a-date" $ expectParseEq transactionp "2015/1/1\n" nulltransaction{tdate=fromGregorian 2015 1 1}
,test "more-complex" $ expectParseEq transactionp ,test "more-complex" $ expectParseEq transactionp
(T.unlines [ (T.unlines [
@ -726,8 +726,8 @@ easytests_JournalReader = tests "JournalReader" [
nulltransaction{ nulltransaction{
tsourcepos=JournalSourcePos "" (1,7), -- XXX why 7 here ? tsourcepos=JournalSourcePos "" (1,7), -- XXX why 7 here ?
tpreceding_comment_lines="", tpreceding_comment_lines="",
tdate=parsedate "2012/05/14", tdate=fromGregorian 2012 5 14,
tdate2=Just $ parsedate "2012/05/15", tdate2=Just $ fromGregorian 2012 5 15,
tstatus=Unmarked, tstatus=Unmarked,
tcode="code", tcode="code",
tdescription="desc", tdescription="desc",
@ -814,7 +814,7 @@ easytests_JournalReader = tests "JournalReader" [
,test "marketpricedirectivep" $ expectParseEq marketpricedirectivep ,test "marketpricedirectivep" $ expectParseEq marketpricedirectivep
"P 2017/01/30 BTC $922.83\n" "P 2017/01/30 BTC $922.83\n"
MarketPrice{ MarketPrice{
mpdate = parsedate "2017/01/30", mpdate = fromGregorian 2017 1 30,
mpcommodity = "BTC", mpcommodity = "BTC",
mpamount = usd 922.83 mpamount = usd 922.83
} }