[commit: packages/pretty] large_docs: Add failing test for large vcat (dfc5ff9)

git at git.haskell.org git at git.haskell.org
Fri Jan 23 22:50:04 UTC 2015


Repository : ssh://git@git.haskell.org/pretty

On branch  : large_docs
Link       : http://git.haskell.org/packages/pretty.git/commitdiff/dfc5ff937a8cf27a55d0dfe236ff0cea61b22d00

>---------------------------------------------------------------

commit dfc5ff937a8cf27a55d0dfe236ff0cea61b22d00
Author: Eyal Lotem <eyal.lotem at gmail.com>
Date:   Fri Jun 28 18:13:45 2013 +0300

    Add failing test for large vcat


>---------------------------------------------------------------

dfc5ff937a8cf27a55d0dfe236ff0cea61b22d00
 pretty.cabal             |  1 +
 tests/Test.hs            | 13 +++++++++++++
 tests/TestLargePretty.hs |  7 +++++++
 3 files changed, 21 insertions(+)

diff --git a/pretty.cabal b/pretty.cabal
index c763e25..5bb9b70 100644
--- a/pretty.cabal
+++ b/pretty.cabal
@@ -51,6 +51,7 @@ Test-Suite test-pretty
         TestStructures
         UnitPP1
         UnitT3911
+        TestLargePretty
     extensions: CPP, BangPatterns, DeriveGeneric
     include-dirs: src/Text/PrettyPrint
 
diff --git a/tests/Test.hs b/tests/Test.hs
index 107e32a..dda582a 100644
--- a/tests/Test.hs
+++ b/tests/Test.hs
@@ -14,10 +14,12 @@
 import PrettyTestVersion
 import TestGenerators
 import TestStructures
+import TestLargePretty
 
 import UnitPP1
 import UnitT3911
 
+import Control.Exception
 import Control.Monad
 import Data.Char (isSpace)
 import Data.List (intersperse)
@@ -27,6 +29,7 @@ import Test.QuickCheck
 
 main :: IO ()
 main = do
+    large_doc
     check_laws
     check_invariants
     check_improvements
@@ -62,6 +65,16 @@ myAssert :: String -> Bool -> IO ()
 myAssert msg b = putStrLn $ (if b then "Ok, passed " else "Failed test:\n  ") ++ msg
 
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+-- Ordinary tests
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+large_doc :: IO ()
+large_doc = do
+  putStrLn "Testing large doc..."
+  evaluate largeDocRender
+  return ()
+
+-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 -- Quickcheck tests
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/tests/TestLargePretty.hs b/tests/TestLargePretty.hs
new file mode 100644
index 0000000..6d181c4
--- /dev/null
+++ b/tests/TestLargePretty.hs
@@ -0,0 +1,7 @@
+module TestLargePretty where
+
+import Text.PrettyPrint
+import Control.DeepSeq
+
+largeDocRender :: String
+largeDocRender = force $ render $ vcat $ replicate 10000000 $ text "Hello"



More information about the ghc-commits mailing list