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 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
]

View File

@ -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
]

View File

@ -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

View File

@ -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
]

View File

@ -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)

View File

@ -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" [

View File

@ -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