diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-09-10 18:20:45 +0200 |
---|---|---|
committer | Sylvain Henry <sylvain@haskus.fr> | 2020-09-29 17:24:03 +0200 |
commit | 8e3f00dd24936b6674d0a2322f8410125968583e (patch) | |
tree | d9630cc481aff867c16300b049b28e8cdd1a7aa2 /testsuite | |
parent | 4365d77a0b306ada61654c3648b844cfa0f4fdcf (diff) | |
download | haskell-8e3f00dd24936b6674d0a2322f8410125968583e.tar.gz |
Make the parser module less dependent on DynFlags
Bump haddock submodule
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghc-api/T11579.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/T9015.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/parser/should_run/CountParserDeps.hs | 9 |
3 files changed, 11 insertions, 6 deletions
diff --git a/testsuite/tests/ghc-api/T11579.hs b/testsuite/tests/ghc-api/T11579.hs index 9f1cc41f92..f2beeb3035 100644 --- a/testsuite/tests/ghc-api/T11579.hs +++ b/testsuite/tests/ghc-api/T11579.hs @@ -1,5 +1,6 @@ import System.Environment import GHC.Driver.Session +import GHC.Driver.Config import GHC.Data.FastString import GHC import GHC.Data.StringBuffer @@ -16,7 +17,8 @@ main = do hdk_comments <- runGhc (Just libdir) $ do dflags <- getSessionDynFlags - let pstate = mkPState (dflags `gopt_set` Opt_Haddock) stringBuffer loc + let opts = initParserOpts (dflags `gopt_set` Opt_Haddock) + pstate = initParserState opts stringBuffer loc case unP (lexer False return) pstate of POk s (L _ ITeof) -> return (map unLoc (toList (hdk_comments s))) _ -> error "No token" diff --git a/testsuite/tests/ghc-api/T9015.hs b/testsuite/tests/ghc-api/T9015.hs index 3388ee0566..3ca05afc7d 100644 --- a/testsuite/tests/ghc-api/T9015.hs +++ b/testsuite/tests/ghc-api/T9015.hs @@ -3,7 +3,7 @@ module Main where import GHC import GHC.Driver.Session import GHC.Driver.Monad -import GHC.Parser.Lexer (mkParserFlags) +import GHC.Driver.Config import System.Environment testStrings = [ @@ -53,7 +53,7 @@ main = do where testWithParser parser = do dflags <- getSessionDynFlags - let pflags = mkParserFlags dflags + let pflags = initParserOpts dflags liftIO . putStrLn . unlines $ map (testExpr (parser pflags)) testStrings testExpr parser expr = do diff --git a/testsuite/tests/parser/should_run/CountParserDeps.hs b/testsuite/tests/parser/should_run/CountParserDeps.hs index 5d3396f835..ae344aaf49 100644 --- a/testsuite/tests/parser/should_run/CountParserDeps.hs +++ b/testsuite/tests/parser/should_run/CountParserDeps.hs @@ -28,9 +28,12 @@ main = do [libdir] <- getArgs modules <- parserDeps libdir let num = sizeUniqSet modules --- print num --- print (map moduleNameString $ nonDetEltsUniqSet modules) - unless (num <= 201) $ exitWith (ExitFailure num) + max_num = 201 + min_num = max_num - 10 -- so that we don't forget to change the number + -- when the number of dependencies decreases + -- putStrLn $ "Found " ++ show num ++ " parser module dependencies" + -- forM_ (map moduleNameString $ nonDetEltsUniqSet modules) putStrLn + unless (num <= max_num && num >= min_num) $ exitWith (ExitFailure num) parserDeps :: FilePath -> IO (UniqSet ModuleName) parserDeps libdir = |