packages feed

hledger-iadd 1.3.7 → 1.3.8

raw patch · 5 files changed

+18/−33 lines, 5 filesdep ~hledger-libPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hledger-lib

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+# 1.3.8++  - dependencies: Port to hledger-lib-1.13+ # 1.3.7    - feature: Add abbreviated days of the week to date completion (e.g. `mon`,
hledger-iadd.cabal view
@@ -1,5 +1,5 @@ name:                hledger-iadd-version:             1.3.7+version:             1.3.8 synopsis:            A terminal UI as drop-in replacement for hledger add description:         This is a terminal UI as drop-in replacement for hledger add.                      .@@ -33,7 +33,7 @@ tested-with:         GHC ==8.0.2                    , GHC ==8.2.2                    , GHC ==8.4.4-                   , GHC ==8.6.2+                   , GHC ==8.6.3                       extra-source-files:   doc/screencast.gif@@ -61,7 +61,7 @@                      , Data.Time.Ext   default-language:    Haskell2010   build-depends:       base >= 4.9 && < 5-                     , hledger-lib >= 1.12 && < 1.13+                     , hledger-lib >= 1.12 && < 1.14                      , brick >= 0.27                      , vty >= 5.4                      , text@@ -88,7 +88,7 @@   default-language:    Haskell2010   build-depends:       base >= 4.9 && < 5                      , hledger-iadd-                     , hledger-lib >= 1.12 && < 1.13+                     , hledger-lib >= 1.12 && < 1.14                      , brick >= 0.27                      , vty >= 5.4                      , text@@ -116,7 +116,7 @@   default-language:   Haskell2010   build-depends:      base >= 4.9 && < 5                     , hledger-iadd-                    , hledger-lib >= 1.12 && < 1.13+                    , hledger-lib >= 1.13 && < 1.14                     , text                     , transformers >= 0.3                     , time >= 1.5
src/AmountParser.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}- module AmountParser (parseAmount) where  import           Data.Text (Text)@@ -9,11 +7,7 @@ import           Text.Megaparsec import           Text.Megaparsec.Char -#if MIN_VERSION_hledger_lib(1,3,1) type Parser a = HL.JournalParser Identity a-#else-type Parser a = HL.JournalStateParser Identity a-#endif  parseAmount :: HL.Journal -> Text -> Either String HL.MixedAmount parseAmount journal t = case runIdentity $ runParserT (evalStateT (mixed <* optional space <* eof) journal) "" t of
src/main/Main.hs view
@@ -3,7 +3,6 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings, LambdaCase #-} {-# LANGUAGE PackageImports #-}-{-# LANGUAGE CPP #-}  module Main where @@ -527,11 +526,7 @@   let path = runIdentity $ optLedgerFile opts   journalContents <- T.readFile path -#if MIN_VERSION_hledger_lib(1,9,1)   runExceptT (HL.parseAndFinaliseJournal HL.journalp HL.definputopts path journalContents) >>= \case-#else-  runExceptT (HL.parseAndFinaliseJournal HL.journalp True path journalContents) >>= \case-#endif     Left err -> hPutStrLn stderr err >> exitFailure     Right journal -> do       let edit = editorText EditorName (txt . T.concat) (Just 1) ""
tests/ModelSpec.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE CPP #-}  module ModelSpec (spec) where @@ -40,7 +39,7 @@        forM_ (zip (inits postings) postings) $ \(posts, next) -> do         let t = mkTransaction ((2016, 1, 1), "Foo", map (\(x,y) -> (x, y+1)) posts)-        suggest j german (AccountQuestion t "") `shouldReturn` (Just (fst next))+        suggest j german (AccountQuestion t "") `shouldReturn` Just (fst next)     context "at the amount prompt" $ do@@ -52,14 +51,14 @@       forM_ (zip (inits postings) postings) $ \(posts, next) -> do         let t = mkTransaction ((2016, 1, 1), "Foo", posts)         suggest j german (AmountQuestion (fst next) t "")-          `shouldReturn` (Just ("€" <> (T.pack $ show $ snd next) <> ".00"))+          `shouldReturn` Just ("€" <> T.pack (show $ snd next) <> ".00")      it "suggests the balancing amount if accounts don't match with similar transaction" $ do       let postings = [("x", 1), ("y", 2), ("z", 3)]           j = mkJournal [ ((2017, 1, 1), "Foo", postings) ]           t = mkTransaction ((2016, 1, 1), "Foo", [("foo", 3)]) -      suggest j german (AmountQuestion "y" t "") `shouldReturn` (Just "€-3.00")+      suggest j german (AmountQuestion "y" t "") `shouldReturn` Just "€-3.00"      it "initially doesn't suggest an amount if there is no similar transaction" $ do       let j = mkJournal [ ((2017, 1, 1), "Foo", [("x", 2), ("y", 3)]) ]@@ -71,7 +70,7 @@       let j = mkJournal [ ((2017, 1, 1), "Foo", [("x", 2), ("y", 3)]) ]           t = mkTransaction ((2016, 1, 1), "Bar", [("foo", 3)]) -      suggest j german (AmountQuestion "y" t "") `shouldReturn` (Just "€-3.00")+      suggest j german (AmountQuestion "y" t "") `shouldReturn` Just "€-3.00"   accByFreqSpec :: Spec@@ -91,13 +90,7 @@     accountsByFrequency j `shouldBe` ["x:y", "x:z", "x"]    it "includes accounts from the 'account directive'" $ do-#if MIN_VERSION_hledger_lib(1,11,0)-    let j = (mkJournal [ ((2017, 1, 1), "Foo", [("x:y", 2)]) ]) { HL.jdeclaredaccounts = ["foo:bar"]}-#elif MIN_VERSION_hledger_lib(1,9,0)-    let j = (mkJournal [ ((2017, 1, 1), "Foo", [("x:y", 2)]) ]) { HL.jaccounts = [("foo:bar", Nothing)]}-#else-    let j = (mkJournal [ ((2017, 1, 1), "Foo", [("x:y", 2)]) ]) { HL.jaccounts = ["foo:bar"]}-#endif+    let j = (mkJournal [ ((2017, 1, 1), "Foo", [("x:y", 2)]) ]) { HL.jdeclaredaccounts = [("foo:bar", HL.nullaccountdeclarationinfo)]}     accountsByFrequency j `shouldContain` ["foo:bar", "foo"]  @@ -169,7 +162,7 @@      isDuplicateTransaction (HL.addTransaction t2 HL.nulljournal) t1 `shouldBe` True     isDuplicateTransaction (HL.addTransaction t3 HL.nulljournal) t1 `shouldBe` True-      +   it "considers date and description" $ do     let       t1 = ((2017,9,23), "Test", [("Test", 1), ("Toast", -1)])@@ -178,8 +171,8 @@      isDuplicateTransaction (mkJournal [t1]) (mkTransaction t2) `shouldBe` False     isDuplicateTransaction (mkJournal [t1]) (mkTransaction t3) `shouldBe` False-       +   it "considers date, amount and account of postings" $ do     let       t1 = ((2017,9,23), "Test", [("Test", 1), ("Toast", -1)])@@ -218,8 +211,8 @@ -- Transactions consists of the date, a description and a list of postings in -- for form of (account, amount) mkJournal :: [(Date, Text, [(Text, Int)])] -> HL.Journal-mkJournal transactions =-  foldl (\j t -> HL.addTransaction (mkTransaction t) j) HL.nulljournal transactions+mkJournal =+  foldl (\j t -> HL.addTransaction (mkTransaction t) j) HL.nulljournal  mkTransaction :: (Date, Text, [(Text, Int)]) -> HL.Transaction mkTransaction ((year,month,day), desc, postings) = HL.nulltransaction@@ -233,4 +226,3 @@   { HL.paccount = account   , HL.pamount = HL.mixed [HL.eur (fromIntegral amount)]   }-