From fa772dad6752b77d55a521322aa9228a35b9f977 Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 25 Apr 2016 22:59:31 -0400 Subject: backport testsuite to base 4.6.0 --- kiki.cabal | 11 ++++++++--- testkiki/testkiki.hs | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/kiki.cabal b/kiki.cabal index c73eb67..3810355 100644 --- a/kiki.cabal +++ b/kiki.cabal @@ -23,6 +23,9 @@ Flag needlocale Description: Link against old-locale package for older versions of the time package. Default: False +Flag unixEnv + Default: False + Executable kiki Main-is: kiki.hs -- base >=4.6 due to use of readEither in KikiD.Message @@ -126,8 +129,7 @@ Test-suite testkiki type: exitcode-stdio-1.0 Main-is: testkiki.hs hs-source-dirs: testkiki - Build-depends: base - , Cabal + Build-depends: Cabal , hspec , process , directory @@ -135,4 +137,7 @@ Test-suite testkiki , filepath , bytestring , kiki - + if flag(unixEnv) + Build-depends: base < 4.7.0, unix + else + Build-depends: base >= 4.7.0 diff --git a/testkiki/testkiki.hs b/testkiki/testkiki.hs index 839cebf..32c8284 100644 --- a/testkiki/testkiki.hs +++ b/testkiki/testkiki.hs @@ -1,5 +1,9 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DoAndIfThenElse #-} +{-# LANGUAGE CPP #-} +#if !MIN_VERSION_base(4,7,0) +import qualified System.Posix.Env +#endif import System.Environment --import System.Posix.Env.ByteString (getEnv) import System.Posix.Files @@ -15,6 +19,10 @@ import Control.Applicative import Control.Monad import qualified Data.ByteString.Char8 as B +#if !MIN_VERSION_base(4,7,0) +setEnv k v = System.Posix.Env.setEnv k v True +unsetEnv = System.Posix.Env.unsetEnv +#endif data TestKikiSettings = TKS { gnupghome :: FilePath @@ -22,7 +30,6 @@ data TestKikiSettings = TKS } deriving (Show,Eq) - main = do args <- getArgs cwd <- getCurrentDirectory -- cgit v1.2.3