From a06b3e3d6685b332976aee01005ee6fbd494fea4 Mon Sep 17 00:00:00 2001 From: Alec Theriault Date: Wed, 25 Jul 2018 01:13:01 -0700 Subject: [PATCH] Fix remaining tests and update changelog --- cabal-install/Distribution/Client/CmdRepl.hs | 4 ++-- cabal-install/Distribution/Client/CmdRun.hs | 4 ---- .../Distribution/Client/ProjectConfig/Legacy.hs | 15 +++++++++++---- cabal-install/Distribution/Client/Setup.hs | 2 +- cabal-install/changelog | 3 +++ .../Distribution/Client/ProjectConfig.hs | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/cabal-install/Distribution/Client/CmdRepl.hs b/cabal-install/Distribution/Client/CmdRepl.hs index 5e1bdce21de..0a3f4e2ed71 100644 --- a/cabal-install/Distribution/Client/CmdRepl.hs +++ b/cabal-install/Distribution/Client/CmdRepl.hs @@ -179,7 +179,7 @@ replCommand = Client.installCommand { ++ "to the default component (or no component if there is no project present)\n" ++ cmdCommonHelpTextNewBuildBeta, - commandDefaultFlags = (configFlags,configExFlags,installFlags,haddockFlags,testFlags,defaultEnvFlags), + commandDefaultFlags = (configFlags,configExFlags,installFlags,haddockFlags,testFlags,[],defaultEnvFlags), commandOptions = \showOrParseArgs -> map liftOriginal (commandOptions Client.installCommand showOrParseArgs) ++ map liftReplOpts (replOptions showOrParseArgs) @@ -196,7 +196,7 @@ replCommand = Client.installCommand { updateOriginal (a,b,c,d,e) (_,_,_,_,_,f,g) = (a,b,c,d,e,f,g) projectReplOpts (_,_,_,_,_,f,_) = f - updateReplOpts e (a,b,c,d,e,_,g) = (a,b,c,d,e,f,g) + updateReplOpts f (a,b,c,d,e,_,g) = (a,b,c,d,e,f,g) projectEnvOpts (_,_,_,_,_,_,g) = g updateEnvOpts g (a,b,c,d,e,f,_) = (a,b,c,d,e,f,g) diff --git a/cabal-install/Distribution/Client/CmdRun.hs b/cabal-install/Distribution/Client/CmdRun.hs index 2f844f00e4c..f289132dc8d 100644 --- a/cabal-install/Distribution/Client/CmdRun.hs +++ b/cabal-install/Distribution/Client/CmdRun.hs @@ -108,12 +108,8 @@ import System.Directory import System.FilePath ( () ) -<<<<<<< HEAD -runCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags) -======= runCommand :: CommandUI (ConfigFlags, ConfigExFlags, InstallFlags, HaddockFlags, TestFlags) ->>>>>>> Add 'TestFlags' to 'installCommand' runCommand = Client.installCommand { commandName = "new-run", commandSynopsis = "Run an executable.", diff --git a/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs b/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs index 09e13813eab..8fa70e4d038 100644 --- a/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs +++ b/cabal-install/Distribution/Client/ProjectConfig/Legacy.hs @@ -1048,11 +1048,15 @@ legacyPackageConfigFieldDescrs = legacyTestFlags (\flags conf -> conf { legacyTestFlags = flags }) . mapFieldNames - ("test-"++) - . filterFields - [ "log", "machine-log", "show-details", "keep-tix-files" - , "test-options", "test-option" + prefixTest + . addFields + [ newLineListField "test-options" + (showTokenQ . fromPathTemplate) (fmap toPathTemplate parseTokenQ) + testOptions + (\v conf -> conf { testOptions = v }) ] + . filterFields + [ "log", "machine-log", "show-details", "keep-tix-files" ] . commandOptionsToFields ) (testOptions' ParseArgs) @@ -1119,6 +1123,9 @@ legacyPackageConfigFieldDescrs = caseWarning = PWarning $ "The '" ++ name ++ "' field is case sensitive, use 'True' or 'False'.") + prefixTest name | "test-" `isPrefixOf` name = name + | otherwise = "test-" ++ name + legacyPackageConfigSectionDescrs :: [SectionDescr LegacyProjectConfig] legacyPackageConfigSectionDescrs = diff --git a/cabal-install/Distribution/Client/Setup.hs b/cabal-install/Distribution/Client/Setup.hs index ba2513f7859..91ce9489826 100644 --- a/cabal-install/Distribution/Client/Setup.hs +++ b/cabal-install/Distribution/Client/Setup.hs @@ -1896,7 +1896,7 @@ testOptions showOrParseArgs | opt <- commandOptions Cabal.testCommand showOrParseArgs , let name = optionName opt , name `elem` ["log", "machine-log", "show-details", "keep-tix-files" - , "test-options", "test-option" ] + ,"test-options", "test-option"] ] where prefixTest name | "test-" `isPrefixOf` name = name diff --git a/cabal-install/changelog b/cabal-install/changelog index 49dd99e069c..e926ecbe00c 100644 --- a/cabal-install/changelog +++ b/cabal-install/changelog @@ -15,6 +15,9 @@ no longer ignores all arguments except the last one (#5512). * Add the following option aliases for '-dir'-suffixed options: 'storedir', 'logsdir', 'packagedir', 'sourcedir', 'outputdir' (#5484). + * Ported old-style test options to the new-style commands (#5455). + +2.4.0.0 * 'new-run' now allows the user to run scripts that use a special block to define their requirements (as in the executable stanza) in place of a target. This also allows the use of 'cabal' as an interpreter diff --git a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs index bd0ac234b13..386b697cf2e 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs @@ -563,7 +563,7 @@ instance Arbitrary PackageConfig where <*> arbitrary <*> arbitrary <*> arbitrary - <*> arbitrary + <*> shortListOf 5 arbitrary where arbitraryProgramName :: Gen String arbitraryProgramName =