diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out index 960739d6094..46c5f404fd7 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out @@ -655,6 +655,10 @@ In order, the following will be built: Configuring my-0.1... Preprocessing library for my-0.1... Building library for my-0.1... +# checking "using config from message" without URI imports +# cabal v2-build +# checking "using config from message" with URI imports +# cabal v2-build # checking bad conditional # cabal v2-build Error: [Cabal-7090] diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs index d1eddf1fff9..6e9806055ab 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs @@ -261,6 +261,71 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do log "checking if we detect when the same config is imported via many different paths (we don't)" woopping <- cabal' "v2-build" [ "--project-file=woops-0.project" ] + log "checking \"using config from message\" without URI imports" + withDirectory "yops" $ do + yopping <- fails $ cabal' "v2-build" [ "--project-file=../yops-0.project" ] + + -- Use assertRegex when the output is tainted by the temp directory, like + -- this: + -- + -- When using configuration from: + -- - /tmp/cabal-testsuite-286573/yops-0.project + -- - /tmp/cabal-testsuite-286573/yops-2.config etc + assertRegex + "Project configuration is listed in full" + "When using configuration from:\n \ + \ .*yops-0\\.project\n \ + \ .*yops-2\\.config\n \ + \ .*yops-4\\.config\n \ + \ .*yops-6\\.config\n \ + \ .*yops-8\\.config\n \ + \ .*yops-1\\.config\n \ + \ .*yops-3\\.config\n \ + \ .*yops-5\\.config\n \ + \ .*yops-7\\.config\n \ + \ .*yops-9\\.config\n" + yopping + + assertOutputContains + (normalizeWindowsOutput "The following errors occurred: \ + \ - The package directory '.' does not contain any .cabal file.") + yopping + + return () + + log "checking \"using config from message\" with URI imports" + withDirectory "woops" $ do + woopping <- fails $ cabal' "v2-build" [ "--project-file=../woops-0.project" ] + + -- Use assertRegex when the output is tainted by the temp directory, like + -- this: + -- + -- When using configuration from: + -- - /tmp/cabal-testsuite-282695/woops-0.project + -- - /tmp/cabal-testsuite-282695/woops-2.config etc + assertRegex + "Project configuration is listed in full" + "When using configuration from:\n \ + \ .*woops-0\\.project\n \ + \ .*woops-2\\.config\n \ + \ .*woops-4\\.config\n \ + \ .*woops-6\\.config\n \ + \ .*woops-8\\.config\n \ + \ .*woops-1\\.config\n \ + \ .*woops-3\\.config\n \ + \ .*woops-5\\.config\n \ + \ .*woops-7\\.config\n \ + \ .*woops-9\\.config\n \ + \ .*https://www.stackage.org/lts-21.25/cabal.config\n" + woopping + + assertOutputContains + (normalizeWindowsOutput "The following errors occurred: \ + \ - The package directory '.' does not contain any .cabal file.") + woopping + + return () + log "checking bad conditional" badIf <- fails $ cabal' "v2-build" [ "--project-file=bad-conditional.project" ] assertOutputContains "Cannot set compiler in a conditional clause of a cabal project file" badIf