Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add forEachGPD to hackage-tests #6598

Merged
merged 1 commit into from
Mar 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions Cabal/tests/HackageTests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,26 @@ readFieldTest fpath bs = case Parsec.readFields bs' of

parseParsecTest :: Bool -> FilePath -> B.ByteString -> IO ThreeInt
parseParsecTest keepGoing fpath bs = do
let (warnings, parsec) = Parsec.runParseResult $
Parsec.parseGenericPackageDescription bs
let (warnings, result) = Parsec.runParseResult $
Parsec.parseGenericPackageDescription bs

let w | null warnings = 0
| otherwise = 1

case parsec of
Right _ -> return (ThreeInt 1 w 0)
Left (_, errors) | keepGoing -> return (ThreeInt 1 w 1)
| otherwise -> do
case result of
Right gpd -> do
forEachGPD fpath bs gpd
return (ThreeInt 1 w 0)

Left (_, errors) | keepGoing -> return (ThreeInt 1 w 1)
| otherwise -> do
traverse_ (putStrLn . Parsec.showPError fpath) errors
exitFailure

-- | A hook to make queries on Hackage
forEachGPD :: FilePath -> B8.ByteString -> L.GenericPackageDescription -> IO ()
forEachGPD _ _ _ = return ()

-------------------------------------------------------------------------------
-- ThreeInt
-------------------------------------------------------------------------------
Expand Down