diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Configure.hs b/cabal-install/tests/UnitTests/Distribution/Client/Configure.hs index c570d7a738ac192f07ac6f55a16c69dd4e16fa6c..52a23a80ef2e28def74927940a066665b7fcffa2 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Configure.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Configure.hs @@ -23,13 +23,22 @@ tests = [ configureTests ] +defaultTestFlags :: NixStyleFlags () +defaultTestFlags = + (defaultNixStyleFlags ()) + { projectFlags = + mempty + { flagProjectDir = Flag projectDir + } + } + configureTests :: TestTree configureTests = testGroup "Configure tests" [ testCase "New config" $ do let flags = - (defaultNixStyleFlags ()) + defaultTestFlags { configFlags = mempty { configOptimization = Flag MaximumOptimisation @@ -42,7 +51,7 @@ configureTests = @=? (packageConfigOptimization . projectConfigLocalPackages $ snd projConfig) , testCase "Replacement + new config" $ do let flags = - (defaultNixStyleFlags ()) + defaultTestFlags { configExFlags = mempty { configAppend = Flag True @@ -52,10 +61,6 @@ configureTests = { configOptimization = Flag NoOptimisation , configVerbosity = Flag silent } - , projectFlags = - mempty - { flagProjectDir = Flag projectDir - } } (_, ProjectConfig{..}) <- configureAction' flags [] defaultGlobalFlags @@ -63,7 +68,7 @@ configureTests = Flag silent @=? projectConfigVerbosity projectConfigBuildOnly , testCase "Old + new config" $ do let flags = - (defaultNixStyleFlags ()) + defaultTestFlags { configExFlags = mempty { configAppend = Flag True @@ -72,10 +77,6 @@ configureTests = mempty { configVerbosity = Flag silent } - , projectFlags = - mempty - { flagProjectDir = Flag projectDir - } } (_, ProjectConfig{..}) <- configureAction' flags [] defaultGlobalFlags @@ -83,15 +84,11 @@ configureTests = Flag silent @=? projectConfigVerbosity projectConfigBuildOnly , testCase "Old + new config, no appending" $ do let flags = - (defaultNixStyleFlags ()) + defaultTestFlags { configFlags = mempty { configVerbosity = Flag silent } - , projectFlags = - mempty - { flagProjectDir = Flag projectDir - } } (_, ProjectConfig{..}) <- configureAction' flags [] defaultGlobalFlags @@ -99,15 +96,11 @@ configureTests = Flag silent @=? projectConfigVerbosity projectConfigBuildOnly , testCase "Old + new config, backup check" $ do let flags = - (defaultNixStyleFlags ()) + defaultTestFlags { configFlags = mempty { configVerbosity = Flag silent } - , projectFlags = - mempty - { flagProjectDir = Flag projectDir - } } backup = projectDir </> "cabal.project.local~" @@ -122,16 +115,12 @@ configureTests = , testCase "Local program options" $ do let ghcFlags = ["-fno-full-laziness"] flags = - (defaultNixStyleFlags ()) + defaultTestFlags { configFlags = mempty { configVerbosity = Flag silent , configProgramArgs = [("ghc", ghcFlags)] } - , projectFlags = - mempty - { flagProjectDir = Flag projectDir - } } (_, ProjectConfig{..}) <- configureAction' flags [] defaultGlobalFlags diff --git a/cabal-testsuite/cabal.project b/cabal-testsuite/cabal.project new file mode 100644 index 0000000000000000000000000000000000000000..17b04a2b56fb1c6435ba8d4bea3a95e30f746c67 --- /dev/null +++ b/cabal-testsuite/cabal.project @@ -0,0 +1,6 @@ +-- This intercepting project is here to avoid tests picking up a cabal.project +-- from a parent directory, such as the one in the root of the `haskell/cabal` +-- project itself. Having `optional-packages: .` avoids the folowing warning +-- being added to the `.out` file: +-- Warning: There are no packages or optional-packages in the project +optional-packages: .