summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-api/T11579.hs
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2016-02-25 15:51:38 +0100
committerBen Gamari <ben@smart-cactus.org>2016-02-25 17:18:27 +0100
commit6350eb1126e29b93829de688623c91b772f6d9eb (patch)
tree64a4f107929e4d46621d3fc57013008dbcada6bb /testsuite/tests/ghc-api/T11579.hs
parent67393977489942ef41f4f7d4a77076c15db18b92 (diff)
downloadhaskell-6350eb1126e29b93829de688623c91b772f6d9eb.tar.gz
Handle multiline named haddock comments properly
Fixes #10398 in a different way, thereby also fixing #11579. I inverted the logic of the Bool argument to "worker", to hopefully make it more self-explanatory. Reviewers: austin, hvr, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1935
Diffstat (limited to 'testsuite/tests/ghc-api/T11579.hs')
-rw-r--r--testsuite/tests/ghc-api/T11579.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-api/T11579.hs b/testsuite/tests/ghc-api/T11579.hs
new file mode 100644
index 0000000000..3294f999f2
--- /dev/null
+++ b/testsuite/tests/ghc-api/T11579.hs
@@ -0,0 +1,26 @@
+import System.Environment
+import DynFlags
+import FastString
+import GHC
+import StringBuffer
+import Lexer
+import SrcLoc
+
+main :: IO ()
+main = do
+ [libdir] <- getArgs
+
+ let stringBuffer = stringToStringBuffer "-- $bar some\n-- named chunk"
+ loc = mkRealSrcLoc (mkFastString "Foo.hs") 1 1
+
+ token <- runGhc (Just libdir) $ do
+ dflags <- getSessionDynFlags
+ let pstate = mkPState (dflags `gopt_set` Opt_Haddock) stringBuffer loc
+ case unP (lexer False return) pstate of
+ POk _ token -> return (unLoc token)
+ _ -> error "No token"
+
+ -- #11579
+ -- Expected: "ITdocCommentNamed "bar some\n named chunk"
+ -- Actual (with ghc-8.0.1-rc2): "ITdocCommentNamed "bar some"
+ print token