Merge pull request #10634 from cabalism/hlint/unused-lang-pragma
[cabal.git] / cabal-testsuite / PackageTests / NewUpdate / RejectFutureIndexStates / cabal.test.hs
blob442d3508849adaea9022844493587a8703deb621
1 import Test.Cabal.Prelude
2 import Data.List (isPrefixOf)
4 main = skipIfCIAndWindows 10230 >> cabalTest (flakyIfCI 9530 $ withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do
6 output <- last
7 . words
8 . head
9 . filter ("Index cache updated to index-state " `isPrefixOf`)
10 . lines
11 . resultOutput
12 <$> recordMode DoNotRecord (cabal' "update" [])
13 -- update golden output with actual timestamp
14 shell "cp" ["cabal.out.in", "cabal.out"]
15 shell "sed" [ "-i" ++ if not isWindows then "''" else "", "-e", "s/REPLACEME/" <> output <> "/g", "cabal.out"]
16 -- This shall fail with an error message as specified in `cabal.out`
17 fails $ cabal "build" ["--index-state=4000-01-01T00:00:00Z", "fake-pkg"]
18 -- This shall fail by not finding the package, what indicates that it
19 -- accepted an older index-state.
20 fails $ cabal "build" ["--index-state=2023-01-01T00:00:00Z", "fake-pkg"])