From cbd080a3a6107ec02e2129127d0676291cab19c6 Mon Sep 17 00:00:00 2001 From: jneira Date: Sat, 9 May 2020 16:04:26 +0200 Subject: Use existing functions to handle .exe --- tests/ProgramsTest.hs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'tests/ProgramsTest.hs') diff --git a/tests/ProgramsTest.hs b/tests/ProgramsTest.hs index 4e7c557..1c28ced 100644 --- a/tests/ProgramsTest.hs +++ b/tests/ProgramsTest.hs @@ -5,6 +5,7 @@ import Control.Monad import Data.List +import Distribution.Simple.Utils (dropExeExtension) import System.Directory import System.Environment import System.Exit @@ -20,7 +21,7 @@ import Symlink (createSymbolicLink) main :: IO () main = do -- In windows, program name ends with .exe - prog_name <- dropExtension <$> getProgName + prog_name <- dropExeExtension <$> getProgName args <- getArgs case prog_name of "programs-test" @@ -52,15 +53,11 @@ do_test = do withSystemTempDirectory "c-h-programs-test" $ \tmpdir -> do - let ext = case System.Info.os of - "mingw32" -> "exe" - _ -> "" - forM_ ["8.6.5", "8.4.4"] $ \ver -> do - let ghc = tmpdir "ghc-" ++ ver <.> ext - let ghc_pkg = tmpdir "ghc-pkg-" ++ ver <.> ext - let haddock = tmpdir "haddock-" ++ ver <.> ext + let ghc = tmpdir "ghc-" ++ ver <.> exeExtension + let ghc_pkg = tmpdir "ghc-pkg-" ++ ver <.> exeExtension + let haddock = tmpdir "haddock-" ++ ver <.> exeExtension let progs = defaultPrograms { ghcProgram = ghc } let link = case System.Info.os of -- cgit v1.2.3