summaryrefslogtreecommitdiff
path: root/tests/TestDocs.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/TestDocs.hs')
-rw-r--r--tests/TestDocs.hs24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/TestDocs.hs b/tests/TestDocs.hs
index 5fdb416..91bdf52 100644
--- a/tests/TestDocs.hs
+++ b/tests/TestDocs.hs
@@ -18,6 +18,7 @@ import System.Exit
import qualified Language.PureScript as P
import qualified Language.PureScript.Docs as Docs
import qualified Language.PureScript.Publish as Publish
+import qualified Language.PureScript.Publish.ErrorsWarnings as Publish
import TestUtils
@@ -29,16 +30,19 @@ publishOpts = Publish.defaultPublishOptions
where testVersion = ("v999.0.0", Version [999,0,0] [])
main :: IO ()
-main = do
- pushd "examples/docs" $ do
- Docs.Package{..} <- Publish.preparePackage publishOpts
- forM_ testCases $ \(P.moduleNameFromString -> mn, pragmas) ->
- let mdl = takeJust ("module not found in docs: " ++ P.runModuleName mn)
- (find ((==) mn . Docs.modName) pkgModules)
- in forM_ pragmas (flip runAssertionIO mdl)
+main = pushd "examples/docs" $ do
+ res <- Publish.preparePackage publishOpts
+ case res of
+ Left e -> Publish.printErrorToStdout e >> exitFailure
+ Right Docs.Package{..} ->
+ forM_ testCases $ \(P.moduleNameFromString -> mn, pragmas) ->
+ let mdl = takeJust ("module not found in docs: " ++ P.runModuleName mn)
+ (find ((==) mn . Docs.modName) pkgModules)
+ in forM_ pragmas (`runAssertionIO` mdl)
+
takeJust :: String -> Maybe a -> a
-takeJust msg = maybe (error msg) id
+takeJust msg = fromMaybe (error msg)
data Assertion
-- | Assert that a particular declaration is documented with the given
@@ -254,8 +258,8 @@ testCases =
, ("ExplicitTypeSignatures",
[ ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "explicit" (ShowFn (hasTypeVar "something"))
- , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "anInt" (ShowFn ((==) P.tyInt))
- , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "aNumber" (ShowFn ((==) P.tyNumber))
+ , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "anInt" (ShowFn (P.tyInt ==))
+ , ValueShouldHaveTypeSignature (n "ExplicitTypeSignatures") "aNumber" (ShowFn (P.tyNumber ==))
])
]