diff --git a/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.out b/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.out new file mode 100644 index 00000000000..3c50b2abdfa --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.out @@ -0,0 +1,14 @@ +# checking repl command with a 'cabal.project' and no project options +# cabal repl +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - pkg-one-0.1 (interactive) (first run) +Configuring pkg-one-0.1... +Preprocessing library for pkg-one-0.1... +# checking repl command with the 'all' target +# cabal repl +Build profile: -w ghc- -O1 +In order, the following will be built: + - pkg-one-0.1 (interactive) (first run) +Preprocessing library for pkg-one-0.1... diff --git a/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.project b/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.project new file mode 100644 index 00000000000..2f191f96e7e --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.project @@ -0,0 +1 @@ +packages: pkg-one, pkg-two diff --git a/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.test.hs b/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.test.hs new file mode 100644 index 00000000000..77e6eb308c6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectDupPkg/cabal.test.hs @@ -0,0 +1,25 @@ +import Test.Cabal.Prelude +import Data.List (isInfixOf) + +main = cabalTest . recordMode RecordMarked $ do + liftIO $ skipIfWindows "I'm seeing extra newlines in the output on Windows" + let log = recordHeader . pure + + -- If there is only one package in the project then the target could be inferred. + log "checking repl command with a 'cabal.project' and no project options" + defaultProject <- cabal' "repl" ["pkg-one"] + assertOutputContains "the following will be built" defaultProject + assertOutputContains "pkg-one-0.1" defaultProject + -- Foo is a module in one of the packages pkg-one-0.1 + -- assertOutputContains "Compiling Foo" defaultProject + assertOutputContains "Compiling Bar" defaultProject + + log "checking repl command with the 'all' target" + allTarget <- cabal' "repl" ["all"] + assertOutputContains "the following will be built" allTarget + assertOutputContains "pkg-one-0.1" allTarget + -- Foo is a module in one of the packages pkg-one-0.1 + -- assertOutputContains "Compiling Foo" allTarget + assertOutputContains "Compiling Bar" allTarget + + return () diff --git a/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-one/Foo.hs b/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-one/Foo.hs new file mode 100644 index 00000000000..8a39fe134cf --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-one/Foo.hs @@ -0,0 +1,4 @@ +module Foo where + +a :: Int +a = 42 diff --git a/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-one/pkg-one.cabal b/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-one/pkg-one.cabal new file mode 100644 index 00000000000..3e17e5074d7 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-one/pkg-one.cabal @@ -0,0 +1,9 @@ +name: pkg-one +version: 0.1 +license: BSD3 +cabal-version: >=1.2 +build-type: Simple + +library + exposed-modules: Foo + build-depends: base diff --git a/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-two/Bar.hs b/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-two/Bar.hs new file mode 100644 index 00000000000..870176c2b2d --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-two/Bar.hs @@ -0,0 +1,4 @@ +module Bar where + +a :: Int +a = 42 diff --git a/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-two/pkg-one.cabal b/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-two/pkg-one.cabal new file mode 100644 index 00000000000..5708318ba15 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectDupPkg/pkg-two/pkg-one.cabal @@ -0,0 +1,9 @@ +name: pkg-one +version: 0.1 +license: BSD3 +cabal-version: >=1.2 +build-type: Simple + +library + exposed-modules: Bar + build-depends: base