diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.expect.txt b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.expect.txt new file mode 100644 index 00000000000..f81a82a6c73 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.expect.txt @@ -0,0 +1,6 @@ +When using configuration from: + - cabal-missing-package.project + - missing/pkgs.config + - missing/pkgs/default.config +The following errors occurred: + - The package location 'pkg-doesnt-exist' does not exist. diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs index d0abb33de2d..1db5ca2d265 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs @@ -1,6 +1,7 @@ import Test.Cabal.Prelude import Test.Cabal.OutputNormalizer import Data.Function ((&)) +import Data.Functor ((<&>)) main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do let log = recordHeader . pure @@ -111,64 +112,8 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do log "checking that imports work skipping into a subfolder and then back out again and again" hopping <- cabal' "v2-build" [ "--project-file=hops-0.project" ] - "Configuration is affected by the following files:\n\ - \- hops-0.project\n\ - \- hops-2.config\n\ - \ imported by: hops/hops-1.config\n\ - \ imported by: hops-0.project\n\ - \- hops-4.config\n\ - \ imported by: hops/hops-3.config\n\ - \ imported by: hops-2.config\n\ - \ imported by: hops/hops-1.config\n\ - \ imported by: hops-0.project\n\ - \- hops-6.config\n\ - \ imported by: hops/hops-5.config\n\ - \ imported by: hops-4.config\n\ - \ imported by: hops/hops-3.config\n\ - \ imported by: hops-2.config\n\ - \ imported by: hops/hops-1.config\n\ - \ imported by: hops-0.project\n\ - \- hops-8.config\n\ - \ imported by: hops/hops-7.config\n\ - \ imported by: hops-6.config\n\ - \ imported by: hops/hops-5.config\n\ - \ imported by: hops-4.config\n\ - \ imported by: hops/hops-3.config\n\ - \ imported by: hops-2.config\n\ - \ imported by: hops/hops-1.config\n\ - \ imported by: hops-0.project\n\ - \- hops/hops-1.config\n\ - \ imported by: hops-0.project\n\ - \- hops/hops-3.config\n\ - \ imported by: hops-2.config\n\ - \ imported by: hops/hops-1.config\n\ - \ imported by: hops-0.project\n\ - \- hops/hops-5.config\n\ - \ imported by: hops-4.config\n\ - \ imported by: hops/hops-3.config\n\ - \ imported by: hops-2.config\n\ - \ imported by: hops/hops-1.config\n\ - \ imported by: hops-0.project\n\ - \- hops/hops-7.config\n\ - \ imported by: hops-6.config\n\ - \ imported by: hops/hops-5.config\n\ - \ imported by: hops-4.config\n\ - \ imported by: hops/hops-3.config\n\ - \ imported by: hops-2.config\n\ - \ imported by: hops/hops-1.config\n\ - \ imported by: hops-0.project\n\ - \- hops/hops-9.config\n\ - \ imported by: hops-8.config\n\ - \ imported by: hops/hops-7.config\n\ - \ imported by: hops-6.config\n\ - \ imported by: hops/hops-5.config\n\ - \ imported by: hops-4.config\n\ - \ imported by: hops/hops-3.config\n\ - \ imported by: hops-2.config\n\ - \ imported by: hops/hops-1.config\n\ - \ imported by: hops-0.project" - & normalizeWindowsOutput - & flip (assertOn multilineNeedleHaystack) hopping + readVerbatimFile "hops.expect.txt" >>= + flip (assertOn multilineNeedleHaystack) hopping . normalizeWindowsOutput -- The project is named oops as it is like hops but has conflicting constraints. -- +-- oops-0.project @@ -184,24 +129,8 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do log "checking conflicting constraints skipping into a subfolder and then back out again and again" oopsing <- fails $ cabal' "v2-build" [ "all", "--project-file=oops-0.project" ] - "Could not resolve dependencies:\n\ - \[__0] trying: oops-0.1 (user goal)\n\ - \[__1] next goal: hashable (dependency of oops)\n\ - \[__1] rejecting: hashable-1.4.3.0\n\ - \ (constraint from oops/oops-9.config requires ==1.4.2.0)\n\ - \ imported by: oops-8.config\n\ - \ imported by: oops/oops-7.config\n\ - \ imported by: oops-6.config\n\ - \ imported by: oops/oops-5.config\n\ - \ imported by: oops-4.config\n\ - \ imported by: oops/oops-3.config\n\ - \ imported by: oops-2.config\n\ - \ imported by: oops/oops-1.config\n\ - \ imported by: oops-0.project\n\ - \[__1] rejecting: hashable-1.4.2.0\n\ - \ (constraint from oops-0.project requires ==1.4.3.0)" - & normalizeWindowsOutput - & flip (assertOn multilineNeedleHaystack) oopsing + readVerbatimFile "oops.expect.txt" + >>= flip (assertOn multilineNeedleHaystack) oopsing . normalizeWindowsOutput -- The project is named yops as it is like hops but with y's for forks. -- +-- yops-0.project @@ -243,13 +172,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do log "checking that missing package message lists configuration provenance" missing <- fails $ cabal' "v2-build" [ "--project-file=cabal-missing-package.project" ] - "When using configuration from:\n\ - \ - cabal-missing-package.project\n\ - \ - missing/pkgs.config\n\ - \ - missing/pkgs/default.config\n\ - \The following errors occurred:\n\ - \ - The package location 'pkg-doesnt-exist' does not exist." - & normalizeWindowsOutput - & flip (assertOn multilineNeedleHaystack) missing + readVerbatimFile "cabal-missing-package.expect.txt" + >>= flip (assertOn multilineNeedleHaystack) missing . normalizeWindowsOutput return () diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops.expect.txt b/cabal-testsuite/PackageTests/ConditionalAndImport/hops.expect.txt new file mode 100644 index 00000000000..bf3ea9bc001 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops.expect.txt @@ -0,0 +1,56 @@ +Configuration is affected by the following files: +- hops-0.project +- hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-8.config + imported by: hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-1.config + imported by: hops-0.project +- hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-9.config + imported by: hops-8.config + imported by: hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/oops.expect.txt b/cabal-testsuite/PackageTests/ConditionalAndImport/oops.expect.txt new file mode 100644 index 00000000000..88c23627575 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/oops.expect.txt @@ -0,0 +1,16 @@ +Could not resolve dependencies: +[__0] trying: oops-0.1 (user goal) +[__1] next goal: hashable (dependency of oops) +[__1] rejecting: hashable-1.4.3.0 + (constraint from oops/oops-9.config requires ==1.4.2.0) + imported by: oops-8.config + imported by: oops/oops-7.config + imported by: oops-6.config + imported by: oops/oops-5.config + imported by: oops-4.config + imported by: oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +[__1] rejecting: hashable-1.4.2.0 + (constraint from oops-0.project requires ==1.4.3.0) diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out index 437612a2eca..43a3f25acc2 100644 --- a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out @@ -1,3 +1,4 @@ -# checking "using config from message" with URI imports +# check "using config from message" with URI imports # cabal v2-build -# checking that package directories and locations are reported in order +# check project configuration with URI imports is listed in full and +# check package directories and locations are reported in order diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs index 0c65ff68c60..6d4558761b1 100644 --- a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs @@ -4,40 +4,12 @@ import Data.Function ((&)) main = cabalTest . recordMode RecordMarked $ do let log = recordHeader . pure - log "checking \"using config from message\" with URI imports" + log "check \"using config from message\" with URI imports" out <- fails $ cabal' "v2-build" [ "all", "--dry-run", "--project-file=no-pkgs.project" ] - -- Use assertRegex when the output is tainted by the temp directory, like - -- this: - -- - -- When using configuration from: - -- - /tmp/cabal-testsuite-282695/cabal.project - -- - /tmp/cabal-testsuite-282695/2.config etc - assertRegex - "Project configuration with URI imports is listed in full" - "When using configuration from:(\n|\r\n) \ - \ .*no-pkgs\\.project(\n|\r\n) \ - \ .*0\\.config(\n|\r\n) \ - \ .*2\\.config(\n|\r\n) \ - \ .*4\\.config(\n|\r\n) \ - \ .*6\\.config(\n|\r\n) \ - \ .*8\\.config(\n|\r\n) \ - \ .*1\\.config(\n|\r\n) \ - \ .*3\\.config(\n|\r\n) \ - \ .*5\\.config(\n|\r\n) \ - \ .*7\\.config(\n|\r\n) \ - \ .*9\\.config(\n|\r\n) \ - \ .*with-ghc\\.config(\n|\r\n) \ - \ .*https://www.stackage.org/lts-21.25/cabal.config(\n|\r\n)" - out + log "check project configuration with URI imports is listed in full and" + log "check package directories and locations are reported in order" - log "checking that package directories and locations are reported in order" - - "The following errors occurred:\n\ - \ - The package directory 'no-pkg-1' does not contain any .cabal file.\n\ - \ - The package location 'no-pkg-2-dir' does not exist.\n\ - \ - The package directory 'no-pkg-3' does not contain any .cabal file.\n\ - \ - The package location 'no-pkg-4-dir' does not exist." - & flip (assertOn multilineNeedleHaystack) out + readVerbatimFile "errors.expect.txt" >>= flip (assertOn multilineNeedleHaystack) out return () diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/errors.expect.txt b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/errors.expect.txt new file mode 100644 index 00000000000..93907eea807 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/errors.expect.txt @@ -0,0 +1,19 @@ +When using configuration from: + - no-pkgs.project + - 0.config + - 2.config + - 4.config + - 6.config + - 8.config + - cfg/1.config + - cfg/3.config + - cfg/5.config + - cfg/7.config + - cfg/9.config + - with-ghc.config + - https://www.stackage.org/lts-21.25/cabal.config +The following errors occurred: + - The package directory 'no-pkg-1' does not contain any .cabal file. + - The package location 'no-pkg-2-dir' does not exist. + - The package directory 'no-pkg-3' does not contain any .cabal file. + - The package location 'no-pkg-4-dir' does not exist.