From 6b5cf63c0c8718d705c957ce99d37ea1de1b7a34 Mon Sep 17 00:00:00 2001 From: Fendor Date: Sat, 13 Nov 2021 16:35:37 +0100 Subject: [PATCH] Add test-case for show-casing issue #7395 --- .../PackageTests/Ambiguity/multiple-cabal-files/Main.hs | 4 ++++ .../Ambiguity/multiple-cabal-files/cabal.project | 1 + .../multiple-cabal-files/multiple-cabal-files.cabal | 7 +++++++ .../multiple-cabal-files/multiple-cabal-files2.cabal | 7 +++++++ .../PackageTests/Ambiguity/setup-cabal-file.out | 4 ++++ .../PackageTests/Ambiguity/setup-cabal-file.test.hs | 5 +++++ 6 files changed, 28 insertions(+) create mode 100644 cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/Main.hs create mode 100644 cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/cabal.project create mode 100644 cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/multiple-cabal-files.cabal create mode 100644 cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/multiple-cabal-files2.cabal create mode 100644 cabal-testsuite/PackageTests/Ambiguity/setup-cabal-file.out create mode 100644 cabal-testsuite/PackageTests/Ambiguity/setup-cabal-file.test.hs diff --git a/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/Main.hs b/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/Main.hs new file mode 100644 index 00000000000..65ae4a05d5d --- /dev/null +++ b/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = putStrLn "Hello, Haskell!" diff --git a/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/cabal.project b/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/cabal.project new file mode 100644 index 00000000000..b8bb8dbcee2 --- /dev/null +++ b/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/cabal.project @@ -0,0 +1 @@ +packages: multiple-cabal-files.cabal multiple-cabal-files2.cabal diff --git a/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/multiple-cabal-files.cabal b/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/multiple-cabal-files.cabal new file mode 100644 index 00000000000..fffb8b219f3 --- /dev/null +++ b/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/multiple-cabal-files.cabal @@ -0,0 +1,7 @@ +cabal-version: 2.4 +name: multiple-cabal-files +version: 0.1.0.0 + +executable exe + main-is: Main.hs + diff --git a/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/multiple-cabal-files2.cabal b/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/multiple-cabal-files2.cabal new file mode 100644 index 00000000000..5edaf1757b5 --- /dev/null +++ b/cabal-testsuite/PackageTests/Ambiguity/multiple-cabal-files/multiple-cabal-files2.cabal @@ -0,0 +1,7 @@ +cabal-version: 2.4 +name: multiple-cabal-files +version: 0.1.0.0 + +executable exe + main-is: Main.hs + diff --git a/cabal-testsuite/PackageTests/Ambiguity/setup-cabal-file.out b/cabal-testsuite/PackageTests/Ambiguity/setup-cabal-file.out new file mode 100644 index 00000000000..507cab132d3 --- /dev/null +++ b/cabal-testsuite/PackageTests/Ambiguity/setup-cabal-file.out @@ -0,0 +1,4 @@ +# cabal v2-build +Error: cabal: Multiple packages have been found: +multiple-cabal-files-0.1.0.0 defined in: ./multiple-cabal-files.cabal +multiple-cabal-files-0.1.0.0 defined in: ./multiple-cabal-files2.cabal diff --git a/cabal-testsuite/PackageTests/Ambiguity/setup-cabal-file.test.hs b/cabal-testsuite/PackageTests/Ambiguity/setup-cabal-file.test.hs new file mode 100644 index 00000000000..df54961f7a9 --- /dev/null +++ b/cabal-testsuite/PackageTests/Ambiguity/setup-cabal-file.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude +-- Test that we can resolve a module name ambiguity when reexporting +-- by explicitly specifying what package we want. +main = cabalTest $ withDirectory "multiple-cabal-files" $ + fails $ cabal "v2-build" []