From f1441be40402dab19924cf518acd3648ad6f781e Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 15 Jan 2019 12:57:51 -0800 Subject: [PATCH] lib: basic unit test for parseAndFinaliseJournal --- hledger-lib/Hledger/Read/JournalReader.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index 0d527d1ad..fb0a434da 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -66,7 +66,7 @@ import Prelude () import "base-compat-batteries" Prelude.Compat hiding (readFile) import qualified Control.Exception as C import Control.Monad -import Control.Monad.Except (ExceptT(..)) +import Control.Monad.Except (ExceptT(..), runExceptT) import Control.Monad.State.Strict import Data.Maybe import qualified Data.Map.Strict as M @@ -870,4 +870,12 @@ tests_JournalReader = tests "JournalReader" [ test "empty file" $ expectParseEqE journalp "" nulljournal ] + -- defined here so it can use journalp + ,tests "parseAndFinaliseJournal" [ + test "basic" $ do + ej <- io $ runExceptT $ parseAndFinaliseJournal journalp definputopts "" "2019-1-1\n" + let Right j = ej + expectEqPP [""] $ journalFilePaths j + ] + ]