Skip to content

Commit 73a13f1

Browse files
committed
Add test projects
- Add woops test - Regen expected output without duplication - Add "when using config from" tests - Remove unnecessary normalizeWindowsOutput - Change assertion message - Match on (\n|\r\n) for line endings - Note /tmp/cabal-testsuite-*/ not seen on Windows - Always have the project itself sort first - Use with-ghc.config with woops project - Remove docProjectConfigPaths - docProjectConfigFiles is the better name when not reporting "imported by" - Use --dry-run for config listing tests - Only use woops project once in tests - Don't use same project twice in tests - Put dedup test into its own folder - Simplify the project file names - Can be done now that the test is in its own folder - Move using config dedup test to ProjectImport dir - Remove an additional test on yops project - checking "using config from message" without URI imports - Add simple test for changelog - Better explain the message changes - Redo the test so the project doesn't sort 1st - Don't need to specify default project explicitly - Add a z-empty.config lexically sorted last
1 parent 124d471 commit 73a13f1

File tree

26 files changed

+220
-6
lines changed

26 files changed

+220
-6
lines changed

cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ cyclical import of cyclical-2-out-out-self-b.config;
6767
# checking that cyclical check doesn't false-positive on same file names in different folders; hoping within a folder and then into a subfolder
6868
# cabal v2-build
6969
Configuration is affected by the following files:
70+
- noncyclical-same-filename-a.project
7071
- noncyclical-same-filename-a.config
7172
imported by: noncyclical-same-filename-a.project
72-
- noncyclical-same-filename-a.project
7373
- same-filename/noncyclical-same-filename-a.config
7474
imported by: noncyclical-same-filename-a.config
7575
imported by: noncyclical-same-filename-a.project
@@ -83,10 +83,10 @@ Building library for my-0.1...
8383
# checking that cyclical check doesn't false-positive on same file names in different folders; hoping into a subfolder and then back out again
8484
# cabal v2-build
8585
Configuration is affected by the following files:
86+
- noncyclical-same-filename-b.project
8687
- noncyclical-same-filename-b.config
8788
imported by: same-filename/noncyclical-same-filename-b.config
8889
imported by: noncyclical-same-filename-b.project
89-
- noncyclical-same-filename-b.project
9090
- same-filename/noncyclical-same-filename-b.config
9191
imported by: noncyclical-same-filename-b.project
9292
Up to date
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- WARNING: Override the `with-compiler: ghc-x.y.z` of the stackage import, of
2+
-- https://www.stackage.org/nightly-yyyy-mm-dd/cabal.config. Otherwise tests
3+
-- will fail with:
4+
-- -Error: [Cabal-5490]
5+
-- -Cannot find the program 'ghc'. User-specified path 'ghc-x.y.z' does not
6+
-- refer to an executable and the program is not on the system path.
7+
with-compiler: ghc
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import: cfg/1.config
2+
import: cfg/3.config
3+
import: cfg/5.config
4+
import: cfg/7.config
5+
import: cfg/9.config
6+
7+
import: with-ghc.config
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import: cfg/3.config
2+
import: https://www.stackage.org/lts-21.25/cabal.config
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import: cfg/5.config
2+
import: https://www.stackage.org/lts-21.25/cabal.config
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import: cfg/7.config
2+
import: https://www.stackage.org/lts-21.25/cabal.config
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import: cfg/9.config
2+
import: https://www.stackage.org/lts-21.25/cabal.config
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# checking "using config from message" with URI imports
2+
# cabal v2-build
3+
# checking that package directories and locations are reported in order
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import Test.Cabal.Prelude
2+
3+
main = cabalTest . recordMode RecordMarked $ do
4+
let log = recordHeader . pure
5+
6+
log "checking \"using config from message\" with URI imports"
7+
out <- fails $ cabal' "v2-build" [ "all", "--dry-run", "--project-file=no-pkgs.project" ]
8+
9+
-- Use assertRegex when the output is tainted by the temp directory, like
10+
-- this:
11+
--
12+
-- When using configuration from:
13+
-- - /tmp/cabal-testsuite-282695/cabal.project
14+
-- - /tmp/cabal-testsuite-282695/2.config etc
15+
assertRegex
16+
"Project configuration with URI imports is listed in full"
17+
"When using configuration from:(\n|\r\n) \
18+
\ .*no-pkgs\\.project(\n|\r\n) \
19+
\ .*0\\.config(\n|\r\n) \
20+
\ .*2\\.config(\n|\r\n) \
21+
\ .*4\\.config(\n|\r\n) \
22+
\ .*6\\.config(\n|\r\n) \
23+
\ .*8\\.config(\n|\r\n) \
24+
\ .*1\\.config(\n|\r\n) \
25+
\ .*3\\.config(\n|\r\n) \
26+
\ .*5\\.config(\n|\r\n) \
27+
\ .*7\\.config(\n|\r\n) \
28+
\ .*9\\.config(\n|\r\n) \
29+
\ .*with-ghc\\.config(\n|\r\n) \
30+
\ .*https://www.stackage.org/lts-21.25/cabal.config(\n|\r\n)"
31+
out
32+
33+
log "checking that package directories and locations are reported in order"
34+
assertOutputContains
35+
"The following errors occurred: \
36+
\ - The package directory 'no-pkg-1' does not contain any .cabal file. \
37+
\ - The package location 'no-pkg-2-dir' does not exist. \
38+
\ - The package directory 'no-pkg-3' does not contain any .cabal file. \
39+
\ - The package location 'no-pkg-4-dir' does not exist."
40+
out
41+
42+
return ()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import: ../2.config
2+
import: https://www.stackage.org/lts-21.25/cabal.config

0 commit comments

Comments
 (0)