-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for RejectFutureIndexStates and fix other tests
- Loading branch information
Showing
10 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
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
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
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,4 @@ | ||
# cabal get | ||
Warning: <ROOT>/cabal.config: Unrecognized stanza on line 3 | ||
Warning: The package list for 'repo.invalid' does not exist. Run 'cabal update' to download it. | ||
Error: [Cabal-7100] | ||
There is no package named 'a-b-s-e-n-t'. | ||
You may need to run 'cabal update' to get the latest list of available packages. | ||
Error: [Cabal-7160] | ||
The package list for 'repo.invalid' does not exist. Run 'cabal update' to download it. |
13 changes: 13 additions & 0 deletions
13
cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/cabal.out.in
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,13 @@ | ||
# cabal build | ||
Error: [Cabal-7159] | ||
Latest known index-state for 'repository.localhost' (REPLACEME) is older than the requested index-state (4000-01-01T00:00:00Z). | ||
Run 'cabal update' or set the index-state to a value at or before REPLACEME. | ||
# cabal build | ||
Warning: There is no index-state for 'repository.localhost' exactly at the requested timestamp (2023-01-01T00:00:00Z). Also, there are no index-states before the one requested, so the repository 'repository.localhost' will be empty. | ||
Resolving dependencies... | ||
Error: [Cabal-7107] | ||
Could not resolve dependencies: | ||
[__0] trying: fake-pkg-1.0 (user goal) | ||
[__1] unknown package: pkg (dependency of fake-pkg) | ||
[__1] fail (backjumping, conflict set: fake-pkg, pkg) | ||
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: fake-pkg (2), pkg (1) |
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/cabal.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 @@ | ||
packages: fake-pkg |
19 changes: 19 additions & 0 deletions
19
cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Test.Cabal.Prelude | ||
import Data.List (isPrefixOf) | ||
|
||
main = cabalTest $ withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do | ||
output <- last | ||
. words | ||
. head | ||
. filter ("Index cache updated to index-state " `isPrefixOf`) | ||
. lines | ||
. resultOutput | ||
<$> recordMode DoNotRecord (cabal' "update" []) | ||
-- update golden output with actual timestamp | ||
shell "cp" ["cabal.out.in", "cabal.out"] | ||
shell "sed" ["-i''", "-e", "s/REPLACEME/" <> output <> "/g", "cabal.out"] | ||
-- This shall fail with an error message as specified in `cabal.out` | ||
fails $ cabal "build" ["--index-state=4000-01-01T00:00:00Z", "fake-pkg"] | ||
-- This shall fail by not finding the package, what indicates that it | ||
-- accepted an older index-state. | ||
fails $ cabal "build" ["--index-state=2023-01-01T00:00:00Z", "fake-pkg"] |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/fake-pkg/Main.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Main where | ||
|
||
main = print "hello" |
8 changes: 8 additions & 0 deletions
8
cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/fake-pkg/fake-pkg.cabal
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,8 @@ | ||
version: 1.0 | ||
name: fake-pkg | ||
build-type: Simple | ||
cabal-version: >= 1.2 | ||
|
||
executable my-exe | ||
main-is: Main.hs | ||
build-depends: base, pkg |
3 changes: 3 additions & 0 deletions
3
cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/repo/pkg-1.0/Foo.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Foo (someFunc) where | ||
|
||
someFunc = "hello" |
8 changes: 8 additions & 0 deletions
8
cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/repo/pkg-1.0/pkg.cabal
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,8 @@ | ||
name: pkg | ||
version: 1.0 | ||
build-type: Simple | ||
cabal-version: >= 1.2 | ||
|
||
library | ||
exposed-modules: Foo | ||
build-depends: base |