Skip to content

Commit

Permalink
Test projects with import then constraints and vice-versa
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Dec 21, 2023
1 parent 5e0366c commit 11c1cb3
Show file tree
Hide file tree
Showing 20 changed files with 200 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: .
allow-newer: hashable:*
import: stackage-local.config
constraints: hashable ==1.4.2.0
26 changes: 23 additions & 3 deletions cabal-testsuite/PackageTests/VersionPriority/1-local.out
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# --version-win not supplied, default
# 1-local-constraints-import.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=shallowest
# 1-local-constraints-import.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=latest
# 1-local-constraints-import.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.3.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 1-local-import-constraints.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 1-local-import-constraints.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 1-local-import-constraints.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
21 changes: 13 additions & 8 deletions cabal-testsuite/PackageTests/VersionPriority/1-local.test.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import Test.Cabal.Prelude

main = cabalTest . withRepo "repo" . withProjectFile "1-local.project" . recordMode RecordMarked $ do
let log = recordHeader . pure
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]
testVersionWin project =
withProjectFile project $ do
let log = recordHeader . pure . ((project <> " ") <>)
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]

main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
testVersionWin "1-local-constraints-import.project"
testVersionWin "1-local-import-constraints.project"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: .
allow-newer: hashable:*
import: https://www.stackage.org/nightly-2023-12-07/cabal.config
constraints: hashable ==1.4.2.0
26 changes: 23 additions & 3 deletions cabal-testsuite/PackageTests/VersionPriority/1-web.out
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# --version-win not supplied, default
# 1-web-constraints-import.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=shallowest
# 1-web-constraints-import.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=latest
# 1-web-constraints-import.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.3.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 1-web-import-constraints.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 1-web-import-constraints.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 1-web-import-constraints.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
21 changes: 13 additions & 8 deletions cabal-testsuite/PackageTests/VersionPriority/1-web.test.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import Test.Cabal.Prelude

main = cabalTest . withRepo "repo" . withProjectFile "1-web.project" . recordMode RecordMarked $ do
testVersionWin project =
withProjectFile project $ do
let log = recordHeader . pure . ((project <> " ") <>)
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]

main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
-- To avoid this diff:
-- -Build profile: -w ghc-9.6.3 -O1
-- +Build profile: -w ghc-<GHCVER> -O1
skipIfGhcVersion "== 9.6.3"
let log = recordHeader . pure
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]
testVersionWin "1-web-constraints-import.project"
testVersionWin "1-web-import-constraints.project"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: .
allow-newer: hashable:*
constraints: hashable ==1.4.2.0
import: hop-local.config
26 changes: 23 additions & 3 deletions cabal-testsuite/PackageTests/VersionPriority/2-local.out
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# --version-win not supplied, default
# 2-local-constraints-import.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=shallowest
# 2-local-constraints-import.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=latest
# 2-local-constraints-import.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.3.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 2-local-import-constraints.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 2-local-import-constraints.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 2-local-import-constraints.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
Expand Down
21 changes: 13 additions & 8 deletions cabal-testsuite/PackageTests/VersionPriority/2-local.test.hs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import Test.Cabal.Prelude

main = cabalTest . withRepo "repo" . withProjectFile "2-local.project" . recordMode RecordMarked $ do
let log = recordHeader . pure
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]
testVersionWin project =
withProjectFile project $ do
let log = recordHeader . pure . ((project <> " ") <>)
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]

main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
testVersionWin "2-local-constraints-import.project"
testVersionWin "2-local-import-constraints.project"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: .
allow-newer: hashable:*
constraints: hashable ==1.4.2.0
import: stackage-web.config
26 changes: 23 additions & 3 deletions cabal-testsuite/PackageTests/VersionPriority/2-web.out
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# --version-win not supplied, default
# 2-web-constraints-import.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=shallowest
# 2-web-constraints-import.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=latest
# 2-web-constraints-import.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.3.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 2-web-import-constraints.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 2-web-import-constraints.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 2-web-import-constraints.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
Expand Down
21 changes: 13 additions & 8 deletions cabal-testsuite/PackageTests/VersionPriority/2-web.test.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import Test.Cabal.Prelude

main = cabalTest . withRepo "repo" . withProjectFile "2-web.project" . recordMode RecordMarked $ do
testVersionWin project =
withProjectFile project $ do
let log = recordHeader . pure . ((project <> " ") <>)
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]

main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
-- To avoid this diff:
-- -Build profile: -w ghc-9.6.3 -O1
-- +Build profile: -w ghc-<GHCVER> -O1
skipIfGhcVersion "== 9.6.3"
let log = recordHeader . pure
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]
testVersionWin "2-web-constraints-import.project"
testVersionWin "2-web-import-constraints.project"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages: .
allow-newer: hashable:*
constraints: hashable ==1.4.2.0
import: hop-web.config
26 changes: 23 additions & 3 deletions cabal-testsuite/PackageTests/VersionPriority/3-web.out
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# --version-win not supplied, default
# 3-web-constraints-import.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=shallowest
# 3-web-constraints-import.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# --version-win=latest
# 3-web-constraints-import.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.3.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 3-web-import-constraints.project --version-win not supplied, default
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 3-web-import-constraints.project --version-win=shallowest
# cabal v2-build
Build profile: -w ghc-9.6.3 -O1
In order, the following would be built:
- hashable-1.4.2.0 (lib) (requires build)
- cabal-version-override-0.1.0.0 (exe:cabal-version-override) (first run)
# 3-web-import-constraints.project --version-win=latest
# cabal v2-build
Resolving dependencies...
Build profile: -w ghc-9.6.3 -O1
Expand Down
21 changes: 13 additions & 8 deletions cabal-testsuite/PackageTests/VersionPriority/3-web.test.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import Test.Cabal.Prelude

main = cabalTest . withRepo "repo" . withProjectFile "3-web.project" . recordMode RecordMarked $ do
testVersionWin project =
withProjectFile project $ do
let log = recordHeader . pure . ((project <> " ") <>)
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]

main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do
-- To avoid this diff:
-- -Build profile: -w ghc-9.6.3 -O1
-- +Build profile: -w ghc-<GHCVER> -O1
skipIfGhcVersion "== 9.6.3"
let log = recordHeader . pure
log "--version-win not supplied, default"
cabal "v2-build" ["--dry-run"]
log "--version-win=shallowest"
cabal "v2-build" ["--dry-run", "--version-win=shallowest"]
log "--version-win=latest"
cabal "v2-build" ["--dry-run", "--version-win=latest"]
testVersionWin "3-web-constraints-import.project"
testVersionWin "3-web-import-constraints.project"

0 comments on commit 11c1cb3

Please sign in to comment.