Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
9999years committed Sep 23, 2024
1 parent a268772 commit dd47021
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cabal-version: 3.0
name: Lib
version: 0.1.0.0
license: BSD-3-Clause
author: Edward Z. Yang
maintainer: [email protected]
build-type: Simple

library foo-internal
build-depends: base
exposed-modules: Lib
default-language: Haskell2010

executable exe
main-is: Exe.hs
build-depends: base <=1.0,
package-that-does-not-exist,
Lib:{foo-internal, bar-internal},
hs-source-dirs: exe
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Lib where
lib = "OK"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Lib
main = putStrLn lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Setup configure
Configuring library 'foo-internal' for Lib-0.1.0.0...
# Setup build
Preprocessing library 'foo-internal' for Lib-0.1.0.0...
Building library 'foo-internal' for Lib-0.1.0.0...
# Setup copy
Installing internal library foo-internal in <PATH>
# Setup register
Registering library 'foo-internal' for Lib-0.1.0.0...
# Setup configure
Configuring executable 'exe' for Lib-0.1.0.0...
Error: [Cabal-8010]
Encountered missing or private dependencies:
Lib:{bar-internal,foo-internal} (missing :bar-internal),
base <=1.0 (installed: <VERSION>),
package-that-does-not-exist (missing)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

import Test.Cabal.Prelude
main = setupTest $ do
withPackageDb $ do
base_id <- getIPID "base"
setup_install ["foo-internal", "--cid", "foo-internal-0.1-abc"]
r <- fails $ setup' "configure" [ "exe" ]
assertOutputContains "Lib" r
1 change: 1 addition & 0 deletions cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ normalizeOutput nenv =
. maybe id normalizePathCmdOutput (normalizerCabalInstallVersion nenv)
-- hackage-security locks occur non-deterministically
. resub "(Released|Acquired|Waiting) .*hackage-security-lock\n" ""
. resub "installed: [0-9]+(\\.[0-9]+)*" "installed: <VERSION>"
where
sameDir = "(\\.((\\\\)+|\\/))*"
packageIdRegex pid =
Expand Down

0 comments on commit dd47021

Please sign in to comment.