From a33e376531a4f478bacd41fc3028985405b8c164 Mon Sep 17 00:00:00 2001 From: wz1000 Date: Mon, 11 Oct 2021 15:40:19 +0530 Subject: Enable Haddock tests in GHC windows CI (#1428) * testsuite: strip windows line endings for haddock * hyperlinker: Work around double escaping (#19236) * deterministic SCC --- haddock-test/src/Test/Haddock/Xhtml.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'haddock-test') diff --git a/haddock-test/src/Test/Haddock/Xhtml.hs b/haddock-test/src/Test/Haddock/Xhtml.hs index bca2c4cc..74d8c4f7 100644 --- a/haddock-test/src/Test/Haddock/Xhtml.hs +++ b/haddock-test/src/Test/Haddock/Xhtml.hs @@ -23,8 +23,9 @@ import Data.Char ( isSpace ) newtype Xml = Xml { unXml :: String } -- | Part of parsing involves dropping the @DOCTYPE@ line +-- and windows newline endings parseXml :: String -> Maybe Xml -parseXml = Just . Xml . dropDocTypeLine +parseXml = Just . Xml . filter (/= '\r') . dropDocTypeLine where dropDocTypeLine bs | " Date: Sun, 24 Jul 2022 07:45:59 -0400 Subject: Follow hlint suggestion: redundant $. (#1505) * Follow hlint suggestion: redundant $. * Remove $ and surplus blank lines in Operators. --- .hlint.yaml | 1 - .../src/Haddock/Backends/Hyperlinker/Renderer.hs | 2 +- haddock-api/src/Haddock/Backends/Xhtml/Decl.hs | 2 +- haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | 2 +- haddock-api/src/Haddock/GhcUtils.hs | 2 +- haddock-api/src/Haddock/Interface/Create.hs | 2 +- haddock-api/src/Haddock/Utils/Json.hs | 2 +- haddock-test/src/Test/Haddock.hs | 8 ++-- hypsrc-test/ref/src/Operators.html | 56 +++++++--------------- hypsrc-test/src/Operators.hs | 4 +- 10 files changed, 29 insertions(+), 52 deletions(-) (limited to 'haddock-test') diff --git a/.hlint.yaml b/.hlint.yaml index 4a0c8ddc..b57c494f 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -10,7 +10,6 @@ - ignore: {name: "Move brackets to avoid $"} # 7 hints - ignore: {name: "Move guards forward"} # 1 hint - ignore: {name: "Move map inside list comprehension"} # 2 hints -- ignore: {name: "Redundant $"} # 11 hints - ignore: {name: "Redundant <$>"} # 3 hints - ignore: {name: "Redundant bracket"} # 44 hints - ignore: {name: "Redundant id"} # 1 hint diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs index a8a51e5d..7fa5a443 100644 --- a/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs +++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Renderer.hs @@ -142,7 +142,7 @@ richToken srcs details Token{..} contexts = concatMap (Set.elems . identInfo) . Map.elems . nodeIdentifiers $ details -- pick an arbitrary non-evidence identifier to hyperlink with - identDet = Map.lookupMin $ Map.filter notEvidence $ nodeIdentifiers $ details + identDet = Map.lookupMin $ Map.filter notEvidence $ nodeIdentifiers details notEvidence = not . any isEvidenceContext . identInfo -- If we have name information, we can make links diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs index 8de1b1b8..2c3da7a9 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs @@ -725,7 +725,7 @@ ppInstanceSigs links splice unicode qual sigs = do L _ rtyp = dropWildCards typ -- Instance methods signatures are synified and thus don't have a useful -- SrcSpan value. Use the methods name location instead. - return $ ppSimpleSig links splice unicode qual HideEmptyContexts (getLocA $ head $ lnames) names rtyp + return $ ppSimpleSig links splice unicode qual HideEmptyContexts (getLocA $ head lnames) names rtyp lookupAnySubdoc :: Eq id1 => id1 -> [(id1, DocForDecl id2)] -> DocForDecl id2 diff --git a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs index 18405db8..575249ad 100644 --- a/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs +++ b/haddock-api/src/Haddock/Backends/Xhtml/Layout.hs @@ -220,7 +220,7 @@ subOrphanInstances pkg qual lnks splice = maybe noHtml wrap . instTable where wrap = ((h1 << "Orphan instances") +++) instTable = fmap (thediv ! [ identifier ("section." ++ id_) ] <<) . subTableSrc pkg qual lnks splice - id_ = makeAnchorId $ "orphans" + id_ = makeAnchorId "orphans" subInstHead :: String -- ^ Instance unique id (for anchor generation) diff --git a/haddock-api/src/Haddock/GhcUtils.hs b/haddock-api/src/Haddock/GhcUtils.hs index ebddb397..19494c8e 100644 --- a/haddock-api/src/Haddock/GhcUtils.hs +++ b/haddock-api/src/Haddock/GhcUtils.hs @@ -474,7 +474,7 @@ instance Parent (ConDecl GhcRn) where instance Parent (TyClDecl GhcRn) where children d | isDataDecl d = map unLoc $ concatMap (getConNames . unLoc) - $ (dd_cons . tcdDataDefn) $ d + $ (dd_cons . tcdDataDefn) d | isClassDecl d = map (unLoc . fdLName . unLoc) (tcdATs d) ++ [ unLoc n | L _ (TypeSig _ ns _) <- tcdSigs d, n <- ns ] diff --git a/haddock-api/src/Haddock/Interface/Create.hs b/haddock-api/src/Haddock/Interface/Create.hs index b3796906..17b9f367 100644 --- a/haddock-api/src/Haddock/Interface/Create.hs +++ b/haddock-api/src/Haddock/Interface/Create.hs @@ -331,7 +331,7 @@ mkAliasMap state impDecls = M.fromList $ mapMaybe (\(SrcLoc.L _ impDecl) -> do SrcLoc.L _ alias <- ideclAs impDecl - return $ + return (lookupModuleDyn state -- TODO: This is supremely dodgy, because in general the -- UnitId isn't going to look anything like the package diff --git a/haddock-api/src/Haddock/Utils/Json.hs b/haddock-api/src/Haddock/Utils/Json.hs index 6bcd38fa..0a796b4a 100644 --- a/haddock-api/src/Haddock/Utils/Json.hs +++ b/haddock-api/src/Haddock/Utils/Json.hs @@ -400,7 +400,7 @@ parseIntegralFromDouble d = let r = toRational d x = truncate r in if toRational x == r - then pure $ x + then pure x else fail $ "unexpected floating number " <> show d parseIntegral :: Integral a => String -> Value -> Parser a diff --git a/haddock-test/src/Test/Haddock.hs b/haddock-test/src/Test/Haddock.hs index 1019e815..fe547ad5 100644 --- a/haddock-test/src/Test/Haddock.hs +++ b/haddock-test/src/Test/Haddock.hs @@ -89,9 +89,9 @@ runHaddock cfg@(Config { .. }) = do , pure $ "--odir=" ++ outDir cfgDirConfig tpkg , tpkgFiles tpkg ] - , pcEnv = Just $ cfgEnv - , pcStdOut = Just $ haddockStdOut - , pcStdErr = Just $ haddockStdOut + , pcEnv = Just cfgEnv + , pcStdOut = Just haddockStdOut + , pcStdErr = Just haddockStdOut } let msg = "Failed to run Haddock on test package '" ++ tpkgName tpkg ++ "'" @@ -159,7 +159,7 @@ diffFile cfg diff file = do hFlush stdout handle <- runProcess' diff $ processConfig { pcArgs = [outFile', refFile'] - , pcStdOut = Just $ stdout + , pcStdOut = Just stdout } waitForProcess handle >> return () where diff --git a/hypsrc-test/ref/src/Operators.html b/hypsrc-test/ref/src/Operators.html index 04006a0d..8519d9de 100644 --- a/hypsrc-test/ref/src/Operators.html +++ b/hypsrc-test/ref/src/Operators.html @@ -33,11 +33,6 @@ - - ((a, b) -> c -> (a, b)) -> (a, b) -> c -> (a, b) -forall a b. (a -> b) -> a -> b -$ ( [a] -> [a] a +++ b = a ++ b ++ a @@ -18,6 +17,5 @@ a */\* b = concatMap (*** b) a (**/\**) :: [[a]] -> [[a]] -> [[a]] a **/\** b = zipWith (*/\*) [a +++ b] (a $$$ b) - (#.#) :: a -> b -> (c -> (a, b)) -a #.# b = const $ (a, b) +a #.# b = const (a, b) -- cgit v1.2.3 From 7f2892b571c7b072c86edbf21b7c7469e21f6303 Mon Sep 17 00:00:00 2001 From: Hécate Moonlight Date: Fri, 5 Aug 2022 22:51:57 +0200 Subject: Bump the versions --- cabal.project | 4 ++-- haddock-api/haddock-api.cabal | 4 ++-- haddock-library/haddock-library.cabal | 4 ++-- haddock-test/haddock-test.cabal | 6 +++--- haddock.cabal | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'haddock-test') diff --git a/cabal.project b/cabal.project index 529b2250..e89a2cd5 100644 --- a/cabal.project +++ b/cabal.project @@ -5,7 +5,7 @@ packages: ./ ./haddock-library ./haddock-test -with-compiler: ghc-head +with-compiler: ghc-9.4 allow-newer: ghc-paths:Cabal, @@ -20,4 +20,4 @@ package haddock-api tests: False -- Pinning the index-state helps to make reasonably CI deterministic -index-state: 2021-01-24T12:09:34Z +index-state: 2022-08-05T20:43:48Z diff --git a/haddock-api/haddock-api.cabal b/haddock-api/haddock-api.cabal index 206b9aa2..5923ba37 100644 --- a/haddock-api/haddock-api.cabal +++ b/haddock-api/haddock-api.cabal @@ -46,7 +46,7 @@ library build-depends: base ^>= 4.16.0 , ghc ^>= 9.4 , ghc-paths ^>= 0.1.0.9 - , haddock-library ^>= 1.10 + , haddock-library ^>= 1.11 , xhtml ^>= 3000.2.2 , parsec ^>= 3.1.13.0 @@ -182,7 +182,7 @@ test-suite spec build-depends: ghc ^>= 9.4 , ghc-paths ^>= 0.1.0.12 - , haddock-library ^>= 1.10.0 + , haddock-library ^>= 1.11 , xhtml ^>= 3000.2.2 , hspec ^>= 2.9 , parsec ^>= 3.1.13.0 diff --git a/haddock-library/haddock-library.cabal b/haddock-library/haddock-library.cabal index 9a868725..2e015f2a 100644 --- a/haddock-library/haddock-library.cabal +++ b/haddock-library/haddock-library.cabal @@ -1,6 +1,6 @@ -cabal-version: 2.2 +cabal-version: 3.0 name: haddock-library -version: 1.10.0 +version: 1.11.0 synopsis: Library exposing some functionality of Haddock. description: Haddock is a documentation-generation tool for Haskell diff --git a/haddock-test/haddock-test.cabal b/haddock-test/haddock-test.cabal index df6c4474..4e3bfd29 100644 --- a/haddock-test/haddock-test.cabal +++ b/haddock-test/haddock-test.cabal @@ -1,8 +1,8 @@ -cabal-version: >= 1.10 +cabal-version: 3.0 name: haddock-test version: 0.0.1 synopsis: Test utilities for Haddock -license: BSD2 +license: BSD-2-Clause author: Simon Marlow, David Waern maintainer: Simon Hengel , Mateusz Kowalczyk homepage: http://www.haskell.org/haddock/ @@ -10,7 +10,7 @@ bug-reports: https://github.com/haskell/haddock/issues copyright: (c) Simon Marlow, David Waern category: Documentation build-type: Simple -tested-with: GHC==9.0.* +tested-with: GHC==9.4.* stability: experimental library diff --git a/haddock.cabal b/haddock.cabal index d4d4375f..64ec9699 100644 --- a/haddock.cabal +++ b/haddock.cabal @@ -1,6 +1,6 @@ -cabal-version: 2.4 +cabal-version: 3.0 name: haddock -version: 2.26.1 +version: 2.27.0 synopsis: A documentation-generation tool for Haskell libraries description: This is Haddock, a tool for automatically generating documentation @@ -150,7 +150,7 @@ executable haddock else -- in order for haddock's advertised version number to have proper meaning, -- we pin down to a single haddock-api version. - build-depends: haddock-api == 2.26.1 + build-depends: haddock-api == 2.27.0 test-suite html-test type: exitcode-stdio-1.0 -- cgit v1.2.3