-
Notifications
You must be signed in to change notification settings - Fork 681
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9665 from cabalism/test/project-cyclical-import
Add further tests of cyclical project imports
- Loading branch information
Showing
18 changed files
with
117 additions
and
11 deletions.
There are no files selected for viewing
File renamed without changes.
3 changes: 0 additions & 3 deletions
3
cabal-testsuite/PackageTests/ConditionalAndImport/cabal-cyclical.project
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 61 additions & 5 deletions
66
cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,62 @@ | ||
import Test.Cabal.Prelude | ||
main = cabalTest $ | ||
withRepo "repo" $ do | ||
cabal "v2-run" [ "some-exe" ] | ||
fails $ cabal "v2-build" [ "--project-file=cabal-cyclical.project" ] | ||
fails $ cabal "v2-build" [ "--project-file=cabal-bad-conditional.project" ] | ||
|
||
main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do | ||
let log = recordHeader . pure | ||
|
||
cabal "v2-run" [ "some-exe" ] | ||
|
||
-- +-- cyclical-0-self.project (imports cyclical-0-self.project) | ||
-- +-- cyclical-0-self.project (already processed) | ||
-- +-- etc | ||
log "checking cyclical loopback of a project importing itself" | ||
cyclical0 <- fails $ cabal' "v2-build" [ "--project-file=cyclical-0-self.project" ] | ||
assertOutputContains "cyclical import of cyclical-0-self.project" cyclical0 | ||
|
||
-- +-- cyclical-1-out-back.project | ||
-- +-- cyclical-1-out-back.config (imports cyclical-1-out-back.project) | ||
-- +-- cyclical-1-out-back.project (already processed) | ||
-- +-- etc | ||
log "checking cyclical with hops; out and back" | ||
cyclical1a <- fails $ cabal' "v2-build" [ "--project-file=cyclical-1-out-back.project" ] | ||
assertOutputContains "cyclical import of cyclical-1-out-back.config" cyclical1a | ||
|
||
-- +-- cyclical-1-out-self.project | ||
-- +-- cyclical-1-out-self.config (imports cyclical-1-out-self.config) | ||
-- +-- cyclical-1-out-self.config (already processed) | ||
-- +-- etc | ||
log "checking cyclical with hops; out to a config that imports itself" | ||
cyclical1b <- fails $ cabal' "v2-build" [ "--project-file=cyclical-1-out-self.project" ] | ||
assertOutputContains "cyclical import of cyclical-1-out-self.config" cyclical1b | ||
|
||
-- +-- cyclical-2-out-out-backback.project | ||
-- +-- cyclical-2-out-out-backback-a.config | ||
-- +-- cyclical-2-out-out-backback-b.config (imports cyclical-2-out-out-backback.project) | ||
-- +-- cyclical-2-out-out-backback.project (already processed) | ||
-- +-- etc | ||
log "checking cyclical with hops; out, out, twice back" | ||
cyclical2a <- fails $ cabal' "v2-build" [ "--project-file=cyclical-2-out-out-backback.project" ] | ||
assertOutputContains "cyclical import of cyclical-2-out-out-backback-a.config" cyclical2a | ||
|
||
-- +-- cyclical-2-out-out-back.project | ||
-- +-- cyclical-2-out-out-back-a.config | ||
-- +-- cyclical-2-out-out-back-b.config (imports cyclical-2-out-out-back-a.config) | ||
-- +-- cyclical-2-out-out-back-a.config (already processed) | ||
-- +-- etc | ||
log "checking cyclical with hops; out, out, once back" | ||
cyclical2b <- fails $ cabal' "v2-build" [ "--project-file=cyclical-2-out-out-back.project" ] | ||
assertOutputContains "cyclical import of cyclical-2-out-out-back-a.config" cyclical2b | ||
|
||
-- +-- cyclical-2-out-out-self.project | ||
-- +-- cyclical-2-out-out-self-a.config | ||
-- +-- cyclical-2-out-out-self-b.config (imports cyclical-2-out-out-self-b.config) | ||
-- +-- cyclical-2-out-out-self-b.config (already processed) | ||
-- +-- etc | ||
log "checking cyclical with hops; out, out to a config that imports itself" | ||
cyclical2c <- fails $ cabal' "v2-build" [ "--project-file=cyclical-2-out-out-self.project" ] | ||
assertOutputContains "cyclical import of cyclical-2-out-out-self-b.config" cyclical2c | ||
|
||
log "checking bad conditional" | ||
badIf <- fails $ cabal' "v2-build" [ "--project-file=bad-conditional.project" ] | ||
assertOutputContains "Cannot set compiler in a conditional clause of a cabal project file" badIf | ||
|
||
return () |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-0-self.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: . | ||
|
||
import: cyclical-0-self.project |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-1-out-back.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import: cyclical-1-out-back.project |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-1-out-back.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: . | ||
|
||
import: cyclical-1-out-back.config |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-1-out-self.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import: cyclical-1-out-self.config |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-1-out-self.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: . | ||
|
||
import: cyclical-1-out-self.config |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-back-a.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import: cyclical-2-out-out-back-b.config |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-back-b.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import: cyclical-2-out-out-back-a.config |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-back.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: . | ||
|
||
import: cyclical-2-out-out-back-a.config |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-backback-a.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import: cyclical-2-out-out-backback-b.config |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-backback-b.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import: cyclical-2-out-out-backback.project |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-backback.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: . | ||
|
||
import: cyclical-2-out-out-backback-a.config |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-self-a.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import: cyclical-2-out-out-self-b.config |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-self-b.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import: cyclical-2-out-out-self-b.config |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/ConditionalAndImport/cyclical-2-out-out-self.project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: . | ||
|
||
import: cyclical-2-out-out-self-a.config |