Commit b524d4c5 authored by dterei's avatar dterei
Browse files

Add in quickcheck test

parent 8aced36d
......@@ -22,6 +22,7 @@ Extra-Source-Files: README CHANGELOG
Cabal-Version: >= 1.6
Library
hs-source-dirs: src
exposed-modules:
Text.PrettyPrint
Text.PrettyPrint.HughesPJ
......@@ -30,6 +31,16 @@ Library
extensions: CPP
ghc-options: -Wall -Werror -O -fwarn-tabs
Test-Suite test-pretty
type: exitcode-stdio-1.0
hs-source-dirs: test
src
build-depends: base >= 3 && < 5,
QuickCheck == 1.*
main-is: Test.hs
extensions: CPP
include-dirs: src/Text/PrettyPrint
-- Executable Bench1
-- Main-Is: Bench1.hs
-- Other-Modules:
......
......@@ -179,6 +179,7 @@ Relative to John's original paper, there are the following new features:
Use of unboxed data types to speed up the implementation
-}
#ifndef TESTING
module Text.PrettyPrint.HughesPJ
{-# DEPRECATED "Please use Text.PrettyPrint instead" #-}
(
......@@ -226,7 +227,7 @@ module Text.PrettyPrint.HughesPJ
Mode(..), TextDetails(..)
) where
#endif
import Prelude
import Data.Monoid ( Monoid(mempty, mappend) )
......
--
import Text.PrettyPrint.HughesPJ
main :: IO ()
main = do
putStrLn ""
putStrLn "Note that the correct definition of sep is currently unclear"
putStrLn "It is neither foldr ($+$) empty nor foldr ($$) empty"
putStrLn "------------------------------------------------------------"
let test1 = [ text "" $+$ text "c", nest 3 ( text "a") ]
let test2 = [ text "c", nest 3 ( text "b") ]
putStrLn "--------------------------Test 1----------------------------"
putStrLn "[ text \"\" $+$ text \"c\", nest 3 ( text \"a\") ]"
putStrLn "-----------------------------sep----------------------------"
print $ renderStyle style{lineLength=1} $ sep test1
putStrLn "-----------------------------<+>----------------------------"
print $ renderStyle style{lineLength=1} $ foldr (<+>) empty test1
putStrLn "-----------------------------$+$----------------------------"
print $ renderStyle style{lineLength=1} $ foldr ($+$) empty test1
putStrLn "------------------------------$$----------------------------"
print $ renderStyle style{lineLength=1} $ foldr ($$) empty test1
putStrLn "--------------------------Test 2----------------------------"
putStrLn "[ text \"c\", nest 3 ( text \"b\") ]"
putStrLn "-----------------------------sep----------------------------"
print $ renderStyle style{lineLength=1} $ sep test2
putStrLn "-----------------------------<+>----------------------------"
print $ renderStyle style{lineLength=1} $ foldr (<+>) empty test2
putStrLn "-----------------------------$+$----------------------------"
print $ renderStyle style{lineLength=1} $ foldr ($+$) empty test2
putStrLn "------------------------------$$----------------------------"
print $ renderStyle style{lineLength=1} $ foldr ($$) empty test2
{-# LANGUAGE CPP #-}
#define TESTING
-- | Here we use some CPP hackery to get a whitebox
-- version of HughesPJ for testing purposes.
module PrettyTestVersion where
#include "HughesPJ.hs"
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment