diff --git a/dhall-docs/doctest/Main.hs b/dhall-docs/doctest/Main.hs index eaac1d683..e01a50cb7 100644 --- a/dhall-docs/doctest/Main.hs +++ b/dhall-docs/doctest/Main.hs @@ -1,18 +1,23 @@ -module Main where +module Main (main) where import System.FilePath (()) import qualified GHC.IO.Encoding import qualified System.Directory +import qualified System.Environment import qualified System.IO import qualified Test.DocTest main :: IO () main = do GHC.IO.Encoding.setLocaleEncoding System.IO.utf8 - pwd <- System.Directory.getCurrentDirectory + args <- System.Environment.getArgs + pwd <- System.Directory.getCurrentDirectory prefix <- System.Directory.makeAbsolute pwd - Test.DocTest.doctest + let src = prefix "src" + + Test.DocTest.doctest $ [ "--fast" - , prefix "src" + ] <> args <> + [ src ] diff --git a/dhall-lsp-server/doctest/Main.hs b/dhall-lsp-server/doctest/Main.hs index 20d594862..b858ae470 100644 --- a/dhall-lsp-server/doctest/Main.hs +++ b/dhall-lsp-server/doctest/Main.hs @@ -1,23 +1,26 @@ -module Main where +module Main (main) where import System.FilePath (()) import qualified GHC.IO.Encoding import qualified System.Directory +import qualified System.Environment import qualified System.IO import qualified Test.DocTest main :: IO () main = do - GHC.IO.Encoding.setLocaleEncoding System.IO.utf8 - pwd <- System.Directory.getCurrentDirectory + args <- System.Environment.getArgs + pwd <- System.Directory.getCurrentDirectory prefix <- System.Directory.makeAbsolute pwd + let src = prefix "src" - Test.DocTest.doctest + Test.DocTest.doctest $ [ "--fast" , "-XOverloadedStrings" , "-XRecordWildCards" - , "-i" <> (prefix "src") - , prefix "src/Dhall/LSP/Backend/Diagnostics.hs" + ] <> args <> + [ "-i" <> src + , src "Dhall/LSP/Backend/Diagnostics.hs" ] diff --git a/dhall-toml/doctest/Main.hs b/dhall-toml/doctest/Main.hs index 225dcbcc1..6f968330a 100644 --- a/dhall-toml/doctest/Main.hs +++ b/dhall-toml/doctest/Main.hs @@ -1,14 +1,24 @@ -module Main where +module Main (main) where import System.FilePath (()) +import qualified GHC.IO.Encoding import qualified System.Directory +import qualified System.Environment +import qualified System.IO import qualified Test.DocTest main :: IO () main = do + GHC.IO.Encoding.setLocaleEncoding System.IO.utf8 + args <- System.Environment.getArgs pwd <- System.Directory.getCurrentDirectory prefix <- System.Directory.makeAbsolute pwd let src = prefix "src" - Test.DocTest.doctest [ "--fast", "-i" <> src, src ] + Test.DocTest.doctest $ + [ "--fast" + ] <> args <> + [ "-i" <> src + , src + ] diff --git a/dhall/doctest/Main.hs b/dhall/doctest/Main.hs index d6d4ac57f..053d79411 100644 --- a/dhall/doctest/Main.hs +++ b/dhall/doctest/Main.hs @@ -1,6 +1,6 @@ {-# LANGUAGE CPP #-} -module Main where +module Main (main) where import System.FilePath (()) @@ -13,10 +13,11 @@ import qualified Test.Mockery.Directory main :: IO () main = do - GHC.IO.Encoding.setLocaleEncoding System.IO.utf8 - pwd <- System.Directory.getCurrentDirectory + args <- System.Environment.getArgs + pwd <- System.Directory.getCurrentDirectory prefix <- System.Directory.makeAbsolute pwd + let src = prefix "src" System.Environment.setEnv "XDG_CACHE_HOME" (pwd ".cache") @@ -34,11 +35,12 @@ main = do , "in { name = \"Simon\", favoriteFont = Font.`Comic Sans` } : Person" ] - Test.DocTest.doctest + Test.DocTest.doctest $ [ "-DWITH_HTTP" , "-DUSE_HTTP_CLIENT_TLS" , "--fast" - , prefix "ghc-src" + ] <> args <> + [ prefix "ghc-src" -- Unfortunately we cannot target the entire @src@ directory. -- The reason is that src/Dhall/Version.hs depends on @@ -47,11 +49,11 @@ main = do -- Instead, we target a selection of modules whose combined module -- dependency tree covers all modules that contain doctests. - -- , prefix "src" - , "-i" <> (prefix "src") + -- , src + , "-i" <> src #if __GLASGOW_HASKELL__ >= 806 - , prefix "src/Dhall/Deriving.hs" + , src "Dhall/Deriving.hs" #endif - , prefix "src/Dhall/Tags.hs" - , prefix "src/Dhall/Tutorial.hs" + , src "Dhall/Tags.hs" + , src "Dhall/Tutorial.hs" ]