Skip to content

Test case for project duplicate packages #11139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cabal-testsuite/PackageTests/ProjectDupPkg/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# checking repl command with a 'cabal.project' and no project options
# cabal repl
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -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-<GHCVER> -O1
In order, the following will be built:
- pkg-one-0.1 (interactive) (first run)
Preprocessing library for pkg-one-0.1...
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/ProjectDupPkg/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: pkg-one, pkg-two
25 changes: 25 additions & 0 deletions cabal-testsuite/PackageTests/ProjectDupPkg/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -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 ()
4 changes: 4 additions & 0 deletions cabal-testsuite/PackageTests/ProjectDupPkg/pkg-one/Foo.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Foo where

a :: Int
a = 42
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions cabal-testsuite/PackageTests/ProjectDupPkg/pkg-two/Bar.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Bar where

a :: Int
a = 42
Original file line number Diff line number Diff line change
@@ -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
Loading