From f108b56e6178d77224f104e740985adf7e037abb Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 20 Aug 2018 14:28:40 +0100 Subject: [PATCH] uniquify modules' easytests, simplify imports --- hledger-lib/Hledger.hs | 14 ++++++-------- hledger-lib/Hledger/Data.hs | 8 +++++++- hledger-lib/Hledger/Data/Journal.hs | 4 ++-- hledger-lib/Hledger/Read.hs | 14 ++++++-------- hledger-lib/Hledger/Read/Common.hs | 6 +++--- hledger-lib/Hledger/Read/JournalReader.hs | 8 ++++---- hledger/Hledger/Cli/Commands.hs | 2 +- 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/hledger-lib/Hledger.hs b/hledger-lib/Hledger.hs index bd719abab..20cd5c1c6 100644 --- a/hledger-lib/Hledger.hs +++ b/hledger-lib/Hledger.hs @@ -3,14 +3,12 @@ module Hledger ( module X ,tests_Hledger - ,Hledger.easytests + ,easytests_Hledger ) where -import Hledger.Data as X hiding (easytests) -import qualified Hledger.Data (easytests) -import Hledger.Read as X hiding (samplejournal, easytests) -import qualified Hledger.Read (easytests) +import Hledger.Data as X +import Hledger.Read as X import Hledger.Reports as X import Hledger.Query as X import Hledger.Utils as X @@ -24,7 +22,7 @@ tests_Hledger = TestList ,tests_Hledger_Utils ] -easytests = tests "Hledger" [ - Hledger.Data.easytests - ,Hledger.Read.easytests +easytests_Hledger = tests "Hledger" [ + easytests_Data + ,easytests_Read ] diff --git a/hledger-lib/Hledger/Data.hs b/hledger-lib/Hledger/Data.hs index 47dd635bd..18c73c514 100644 --- a/hledger-lib/Hledger/Data.hs +++ b/hledger-lib/Hledger/Data.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE OverloadedStrings #-} {-| The Hledger.Data library allows parsing and querying of C++ ledger-style @@ -25,7 +26,8 @@ module Hledger.Data ( module Hledger.Data.Transaction, module Hledger.Data.TransactionModifier, module Hledger.Data.Types, - tests_Hledger_Data + tests_Hledger_Data, + easytests_Data, ) where @@ -64,3 +66,7 @@ tests_Hledger_Data = TestList ,tests_Hledger_Data_Transaction -- ,tests_Hledger_Data_Types ] + +easytests_Data = tests "Data" [ + easytests_Journal + ] diff --git a/hledger-lib/Hledger/Data/Journal.hs b/hledger-lib/Hledger/Data/Journal.hs index 57a0849d5..e8229d2f0 100644 --- a/hledger-lib/Hledger/Data/Journal.hs +++ b/hledger-lib/Hledger/Data/Journal.hs @@ -69,7 +69,7 @@ module Hledger.Data.Journal ( -- * Tests samplejournal, tests_Hledger_Data_Journal, - easytests, + easytests_Journal, ) where import Control.Applicative (Const(..)) @@ -1087,7 +1087,7 @@ tests_Hledger_Data_Journal = TestList $ -- journalProfitAndLossAccountNames j `is` ["expenses","expenses:e","income","income:i"] ] -easytests = tests "Journal" [ +easytests_Journal = tests "Journal" [ test "standard account types" $ do let j = samplejournal diff --git a/hledger-lib/Hledger/Read.hs b/hledger-lib/Hledger/Read.hs index 6b7d9b911..b79a87a5d 100644 --- a/hledger-lib/Hledger/Read.hs +++ b/hledger-lib/Hledger/Read.hs @@ -29,9 +29,8 @@ module Hledger.Read ( module Hledger.Read.Common, -- * Tests - samplejournal, tests_Hledger_Read, - easytests, + easytests_Read, ) where @@ -55,9 +54,8 @@ import Text.Printf import Hledger.Data.Dates (getCurrentDay, parsedate, showDate) import Hledger.Data.Types -import Hledger.Read.Common hiding (easytests) -import qualified Hledger.Read.Common (easytests) -import qualified Hledger.Read.JournalReader as JournalReader +import Hledger.Read.Common +import Hledger.Read.JournalReader as JournalReader -- import qualified Hledger.Read.LedgerReader as LedgerReader import qualified Hledger.Read.TimedotReader as TimedotReader import qualified Hledger.Read.TimeclockReader as TimeclockReader @@ -361,7 +359,7 @@ tests_Hledger_Read = TestList $ ] -easytests = tests "Read" [ - Hledger.Read.Common.easytests - ,JournalReader.easytests +easytests_Read = tests "Read" [ + easytests_Common + ,easytests_JournalReader ] diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index 23aa43508..83fd70851 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -93,7 +93,7 @@ module Hledger.Read.Common ( -- * tests tests_Hledger_Read_Common, - Hledger.Read.Common.easytests + easytests_Common, ) where --- * imports @@ -123,7 +123,7 @@ import Text.Megaparsec.Char import Text.Megaparsec.Char.Lexer (decimal) import Text.Megaparsec.Custom -import Hledger.Data hiding (easytests) +import Hledger.Data import Hledger.Utils -- $setup @@ -1232,7 +1232,7 @@ tests_Hledger_Read_Common = TestList [ ,test_spaceandamountormissingp ] -easytests = tests "Common" [ +easytests_Common = tests "Common" [ tests "amountp" [ test "basic" $ expectParseEq amountp "$47.18" (usd 47.18) ,test "ends-with-decimal-mark" $ expectParseEq amountp "$1." (usd 1 `withPrecision` 0) diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index 2b80e2ae6..704775a58 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -58,7 +58,7 @@ module Hledger.Read.JournalReader ( followingcommentp -- * Tests - ,easytests + ,easytests_JournalReader ) where --- * imports @@ -84,8 +84,8 @@ import Text.Printf import System.FilePath import "Glob" System.FilePath.Glob hiding (match) -import Hledger.Data hiding (easytests) -import Hledger.Read.Common hiding (easytests) +import Hledger.Data +import Hledger.Read.Common import Hledger.Read.TimeclockReader (timeclockfilep) import Hledger.Read.TimedotReader (timedotfilep) import Hledger.Utils @@ -576,7 +576,7 @@ postingp mTransactionYear = do --- * tests -easytests = tests "JournalReader" [ +easytests_JournalReader = tests "JournalReader" [ let p = lift accountnamep :: JournalParser IO AccountName in tests "accountnamep" [ diff --git a/hledger/Hledger/Cli/Commands.hs b/hledger/Hledger/Cli/Commands.hs index b967945e6..2c384dcb1 100644 --- a/hledger/Hledger/Cli/Commands.hs +++ b/hledger/Hledger/Cli/Commands.hs @@ -246,7 +246,7 @@ testcmd :: CliOpts -> Journal -> IO () testcmd opts _undefined = do let args = words' $ query_ $ reportopts_ opts putStrLn "\n=== easytest tests: ===\n" - e1 <- runEasyTests args easytests + e1 <- runEasyTests args easytests_Hledger when (not e1) $ putStr "\n" putStrLn "=== hunit tests: ===\n" e2 <- runHunitTests args tests_Hledger_Cli_Commands