Clean up UnitLargeDoc style to be like rest of test-suite large_docs
authorDavid Terei <code@davidterei.com>
Fri, 26 Dec 2014 08:26:42 +0000 (00:26 -0800)
committerDavid Terei <code@davidterei.com>
Fri, 26 Dec 2014 08:27:16 +0000 (00:27 -0800)
pretty.cabal
tests/Test.hs
tests/TestLargePretty.hs [deleted file]
tests/UnitLargeDoc.hs [new file with mode: 0644]

index 1109617..8b81005 100644 (file)
@@ -51,7 +51,7 @@ Test-Suite test-pretty
         TestStructures
         UnitPP1
         UnitT3911
-        TestLargePretty
+        UnitLargeDoc
     extensions: CPP, BangPatterns, DeriveGeneric
     include-dirs: src/Text/PrettyPrint
 
index f9cb025..79e5a49 100644 (file)
 import PrettyTestVersion
 import TestGenerators
 import TestStructures
-import TestLargePretty
 
+import UnitLargeDoc
 import UnitPP1
 import UnitT3911
 
-import Control.Exception
 import Control.Monad
 import Data.Char (isSpace)
 import Data.List (intersperse)
@@ -29,15 +28,18 @@ import Test.QuickCheck
 
 main :: IO ()
 main = do
+    -- quickcheck tests
     check_laws
     check_invariants
     check_improvements
     check_non_prims -- hpc full coverage
     check_rendering
     check_list_def
+    
+    -- unit tests
     testPP1
     testT3911
-    large_doc
+    testLargeDoc
 
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 -- Utility functions
@@ -65,16 +67,6 @@ 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
deleted file mode 100644 (file)
index 6d181c4..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-module TestLargePretty where
-
-import Text.PrettyPrint
-import Control.DeepSeq
-
-largeDocRender :: String
-largeDocRender = force $ render $ vcat $ replicate 10000000 $ text "Hello"
diff --git a/tests/UnitLargeDoc.hs b/tests/UnitLargeDoc.hs
new file mode 100644 (file)
index 0000000..5a44f34
--- /dev/null
@@ -0,0 +1,16 @@
+module UnitLargeDoc where
+
+import Text.PrettyPrint.HughesPJ
+
+import Control.DeepSeq
+import Control.Exception
+
+testLargeDoc :: IO ()
+testLargeDoc = do
+  putStrLn "Testing large doc..."
+  evaluate largeDocRender
+  return ()
+
+largeDocRender :: String
+largeDocRender = force $ render $ vcat $ replicate 10000000 $ text "Hello"
+