#32, add a test that rendering the prefix of an infinite document produces some result
authorNeil Mitchell <ndmitchell@gmail.com>
Thu, 2 Jun 2016 12:15:32 +0000 (13:15 +0100)
committerNeil Mitchell <ndmitchell@gmail.com>
Thu, 2 Jun 2016 12:15:32 +0000 (13:15 +0100)
pretty.cabal
tests/Test.hs
tests/UnitT32.hs [new file with mode: 0755]

index 4bfef78..f3116eb 100644 (file)
@@ -62,6 +62,7 @@ Test-Suite test-pretty
         UnitLargeDoc
         UnitPP1
         UnitT3911
+        UnitT32
     extensions: CPP, BangPatterns, DeriveGeneric
     include-dirs: src/Text/PrettyPrint/Annotated
     ghc-options: -rtsopts -with-rtsopts=-K2M
index bbcd0f7..4d23ac0 100644 (file)
@@ -18,6 +18,7 @@ import TestStructures
 import UnitLargeDoc
 import UnitPP1
 import UnitT3911
+import UnitT32
 
 import Control.Monad
 import Data.Char (isSpace)
@@ -39,6 +40,7 @@ main = do
     -- unit tests
     testPP1
     testT3911
+    testT32
     testLargeDoc
 
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/tests/UnitT32.hs b/tests/UnitT32.hs
new file mode 100755 (executable)
index 0000000..8c1eb85
--- /dev/null
@@ -0,0 +1,9 @@
+-- Test from https://github.com/haskell/pretty/issues/32#issuecomment-223073337
+module UnitT32 where
+
+import Text.PrettyPrint.HughesPJ
+
+import TestUtils
+
+testT32 :: IO ()
+testT32 = simpleMatch "T3911" (replicate 10 'x') $ take 10 $ render $ hcat $ repeat $ text "x"