uniquify modules' easytests, simplify imports

This commit is contained in:
Simon Michael 2018-08-20 14:28:40 +01:00
parent 6568784bf6
commit f108b56e61
7 changed files with 29 additions and 27 deletions

View File

@ -3,14 +3,12 @@
module Hledger ( module Hledger (
module X module X
,tests_Hledger ,tests_Hledger
,Hledger.easytests ,easytests_Hledger
) )
where where
import Hledger.Data as X hiding (easytests) import Hledger.Data as X
import qualified Hledger.Data (easytests) import Hledger.Read as X
import Hledger.Read as X hiding (samplejournal, easytests)
import qualified Hledger.Read (easytests)
import Hledger.Reports as X import Hledger.Reports as X
import Hledger.Query as X import Hledger.Query as X
import Hledger.Utils as X import Hledger.Utils as X
@ -24,7 +22,7 @@ tests_Hledger = TestList
,tests_Hledger_Utils ,tests_Hledger_Utils
] ]
easytests = tests "Hledger" [ easytests_Hledger = tests "Hledger" [
Hledger.Data.easytests easytests_Data
,Hledger.Read.easytests ,easytests_Read
] ]

View File

@ -1,3 +1,4 @@
{-# LANGUAGE OverloadedStrings #-}
{-| {-|
The Hledger.Data library allows parsing and querying of C++ ledger-style 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.Transaction,
module Hledger.Data.TransactionModifier, module Hledger.Data.TransactionModifier,
module Hledger.Data.Types, module Hledger.Data.Types,
tests_Hledger_Data tests_Hledger_Data,
easytests_Data,
) )
where where
@ -64,3 +66,7 @@ tests_Hledger_Data = TestList
,tests_Hledger_Data_Transaction ,tests_Hledger_Data_Transaction
-- ,tests_Hledger_Data_Types -- ,tests_Hledger_Data_Types
] ]
easytests_Data = tests "Data" [
easytests_Journal
]

View File

@ -69,7 +69,7 @@ module Hledger.Data.Journal (
-- * Tests -- * Tests
samplejournal, samplejournal,
tests_Hledger_Data_Journal, tests_Hledger_Data_Journal,
easytests, easytests_Journal,
) )
where where
import Control.Applicative (Const(..)) import Control.Applicative (Const(..))
@ -1087,7 +1087,7 @@ tests_Hledger_Data_Journal = TestList $
-- journalProfitAndLossAccountNames j `is` ["expenses","expenses:e","income","income:i"] -- journalProfitAndLossAccountNames j `is` ["expenses","expenses:e","income","income:i"]
] ]
easytests = tests "Journal" [ easytests_Journal = tests "Journal" [
test "standard account types" $ do test "standard account types" $ do
let let
j = samplejournal j = samplejournal

View File

@ -29,9 +29,8 @@ module Hledger.Read (
module Hledger.Read.Common, module Hledger.Read.Common,
-- * Tests -- * Tests
samplejournal,
tests_Hledger_Read, tests_Hledger_Read,
easytests, easytests_Read,
) where ) where
@ -55,9 +54,8 @@ import Text.Printf
import Hledger.Data.Dates (getCurrentDay, parsedate, showDate) import Hledger.Data.Dates (getCurrentDay, parsedate, showDate)
import Hledger.Data.Types import Hledger.Data.Types
import Hledger.Read.Common hiding (easytests) import Hledger.Read.Common
import qualified Hledger.Read.Common (easytests) import Hledger.Read.JournalReader as JournalReader
import qualified Hledger.Read.JournalReader as JournalReader
-- import qualified Hledger.Read.LedgerReader as LedgerReader -- import qualified Hledger.Read.LedgerReader as LedgerReader
import qualified Hledger.Read.TimedotReader as TimedotReader import qualified Hledger.Read.TimedotReader as TimedotReader
import qualified Hledger.Read.TimeclockReader as TimeclockReader import qualified Hledger.Read.TimeclockReader as TimeclockReader
@ -361,7 +359,7 @@ tests_Hledger_Read = TestList $
] ]
easytests = tests "Read" [ easytests_Read = tests "Read" [
Hledger.Read.Common.easytests easytests_Common
,JournalReader.easytests ,easytests_JournalReader
] ]

View File

@ -93,7 +93,7 @@ module Hledger.Read.Common (
-- * tests -- * tests
tests_Hledger_Read_Common, tests_Hledger_Read_Common,
Hledger.Read.Common.easytests easytests_Common,
) )
where where
--- * imports --- * imports
@ -123,7 +123,7 @@ import Text.Megaparsec.Char
import Text.Megaparsec.Char.Lexer (decimal) import Text.Megaparsec.Char.Lexer (decimal)
import Text.Megaparsec.Custom import Text.Megaparsec.Custom
import Hledger.Data hiding (easytests) import Hledger.Data
import Hledger.Utils import Hledger.Utils
-- $setup -- $setup
@ -1232,7 +1232,7 @@ tests_Hledger_Read_Common = TestList [
,test_spaceandamountormissingp ,test_spaceandamountormissingp
] ]
easytests = tests "Common" [ easytests_Common = tests "Common" [
tests "amountp" [ tests "amountp" [
test "basic" $ expectParseEq amountp "$47.18" (usd 47.18) test "basic" $ expectParseEq amountp "$47.18" (usd 47.18)
,test "ends-with-decimal-mark" $ expectParseEq amountp "$1." (usd 1 `withPrecision` 0) ,test "ends-with-decimal-mark" $ expectParseEq amountp "$1." (usd 1 `withPrecision` 0)

View File

@ -58,7 +58,7 @@ module Hledger.Read.JournalReader (
followingcommentp followingcommentp
-- * Tests -- * Tests
,easytests ,easytests_JournalReader
) )
where where
--- * imports --- * imports
@ -84,8 +84,8 @@ import Text.Printf
import System.FilePath import System.FilePath
import "Glob" System.FilePath.Glob hiding (match) import "Glob" System.FilePath.Glob hiding (match)
import Hledger.Data hiding (easytests) import Hledger.Data
import Hledger.Read.Common hiding (easytests) import Hledger.Read.Common
import Hledger.Read.TimeclockReader (timeclockfilep) import Hledger.Read.TimeclockReader (timeclockfilep)
import Hledger.Read.TimedotReader (timedotfilep) import Hledger.Read.TimedotReader (timedotfilep)
import Hledger.Utils import Hledger.Utils
@ -576,7 +576,7 @@ postingp mTransactionYear = do
--- * tests --- * tests
easytests = tests "JournalReader" [ easytests_JournalReader = tests "JournalReader" [
let p = lift accountnamep :: JournalParser IO AccountName in let p = lift accountnamep :: JournalParser IO AccountName in
tests "accountnamep" [ tests "accountnamep" [

View File

@ -246,7 +246,7 @@ testcmd :: CliOpts -> Journal -> IO ()
testcmd opts _undefined = do testcmd opts _undefined = do
let args = words' $ query_ $ reportopts_ opts let args = words' $ query_ $ reportopts_ opts
putStrLn "\n=== easytest tests: ===\n" putStrLn "\n=== easytest tests: ===\n"
e1 <- runEasyTests args easytests e1 <- runEasyTests args easytests_Hledger
when (not e1) $ putStr "\n" when (not e1) $ putStr "\n"
putStrLn "=== hunit tests: ===\n" putStrLn "=== hunit tests: ===\n"
e2 <- runHunitTests args tests_Hledger_Cli_Commands e2 <- runHunitTests args tests_Hledger_Cli_Commands