cli: parse date2: correctly (#222)
This commit is contained in:
		
							parent
							
								
									663e1f5ba9
								
							
						
					
					
						commit
						77c2c90290
					
				| @ -208,7 +208,7 @@ prefixes = map (++":") [ | ||||
|     ,"desc" | ||||
|     ,"acct" | ||||
|     ,"date" | ||||
|     ,"edate" | ||||
|     ,"date2" | ||||
|     ,"status" | ||||
|     ,"cur" | ||||
|     ,"real" | ||||
| @ -240,12 +240,12 @@ parseQueryTerm d ('n':'o':'t':':':s) = case parseQueryTerm d s of | ||||
| parseQueryTerm _ ('c':'o':'d':'e':':':s) = Left $ Code s | ||||
| parseQueryTerm _ ('d':'e':'s':'c':':':s) = Left $ Desc s | ||||
| parseQueryTerm _ ('a':'c':'c':'t':':':s) = Left $ Acct s | ||||
| parseQueryTerm d ('d':'a':'t':'e':'2':':':s) = | ||||
|         case parsePeriodExpr d s of Left e         -> error' $ "\"date2:"++s++"\" gave a "++showDateParseError e | ||||
|                                     Right (_,span) -> Left $ Date2 span | ||||
| parseQueryTerm d ('d':'a':'t':'e':':':s) = | ||||
|         case parsePeriodExpr d s of Left e         -> error' $ "\"date:"++s++"\" gave a "++showDateParseError e | ||||
|                                     Right (_,span) -> Left $ Date span | ||||
| parseQueryTerm d ('e':'d':'a':'t':'e':':':s) = | ||||
|         case parsePeriodExpr d s of Left e         -> error' $ "\"date:"++s++"\" gave a "++showDateParseError e | ||||
|                                     Right (_,span) -> Left $ Date2 span | ||||
| parseQueryTerm _ ('s':'t':'a':'t':'u':'s':':':s) = Left $ Status $ parseStatus s | ||||
| parseQueryTerm _ ('r':'e':'a':'l':':':s) = Left $ Real $ parseBool s | ||||
| parseQueryTerm _ ('a':'m':'t':':':s) = Left $ Amt ord q where (ord, q) = parseAmountQueryTerm s | ||||
|  | ||||
| @ -177,7 +177,7 @@ tests_balanceReport = | ||||
|    (defreportopts{query_="date:'in 2009'"}, samplejournal2) `gives` | ||||
|     ([], | ||||
|      Mixed [nullamt]) | ||||
|    (defreportopts{query_="edate:'in 2009'"}, samplejournal2) `gives` | ||||
|    (defreportopts{query_="date2:'in 2009'"}, samplejournal2) `gives` | ||||
|     ([ | ||||
|       (("assets:bank:checking","assets:bank:checking",0),mamountp' "$1.00") | ||||
|      ,(("income:salary","income:salary",0),mamountp' "$-1.00") | ||||
|  | ||||
| @ -285,7 +285,7 @@ tests_queryFromOpts = [ | ||||
|                                                       ,query_="date:'to 2013'" | ||||
|                                                       }) | ||||
|   assertEqual "" (Date2 $ mkdatespan "2012/01/01" "2013/01/01") | ||||
|                  (queryFromOpts nulldate defreportopts{query_="edate:'in 2012'"}) | ||||
|                  (queryFromOpts nulldate defreportopts{query_="date2:'in 2012'"}) | ||||
|   assertEqual "" (Or [Acct "a a", Acct "'b"]) | ||||
|                  (queryFromOpts nulldate defreportopts{query_="'a a' 'b"}) | ||||
|  ] | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user