text-show-instances 0.3.0.1 → 0.4
raw patch · 97 files changed
+1282/−1374 lines, 97 filesdep +QuickCheckdep +base-compatdep +hspecdep −tastydep −tasty-hunitdep −tasty-quickcheckdep ~basedep ~template-haskelldep ~textPVP ok
version bump matches the API change (PVP)
Dependencies added: QuickCheck, base-compat, hspec
Dependencies removed: tasty, tasty-hunit, tasty-quickcheck
Dependency ranges changed: base, template-haskell, text, text-show, text-show-instances
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- src/Text/Show/Text/Compiler.hs +0/−13
- src/Text/Show/Text/Compiler/Hoopl.hs +2/−4
- src/Text/Show/Text/Control.hs +0/−14
- src/Text/Show/Text/Data.hs +0/−22
- src/Text/Show/Text/Data/Binary.hs +2/−2
- src/Text/Show/Text/Data/String/UTF8.hs +2/−4
- src/Text/Show/Text/Data/Time.hs +2/−1
- src/Text/Show/Text/Instances.hs +29/−6
- src/Text/Show/Text/Language.hs +0/−13
- src/Text/Show/Text/Language/Haskell/TH.hs +2/−1
- src/Text/Show/Text/System.hs +0/−24
- src/Text/Show/Text/System/Console/Terminfo.hs +14/−2
- src/Text/Show/Text/System/Posix.hs +12/−3
- src/Text/Show/Text/System/Win32.hs +11/−2
- src/Text/Show/Text/Text.hs +0/−13
- src/Text/Show/Text/Text/PrettyPrint.hs +2/−4
- src/Text/Show/Text/Text/XHtml.hs +2/−4
- src/Text/Show/Text/Trace.hs +0/−13
- src/Text/Show/Text/Trace/Hpc.hs +3/−1
- src/Text/Show/Text/Utils.hs +0/−12
- tests/Instances/Compiler/Hoopl.hs +4/−7
- tests/Instances/Control/Applicative/Trans.hs +3/−5
- tests/Instances/Control/Monad/Trans.hs +1/−1
- tests/Instances/Data/Binary.hs +4/−8
- tests/Instances/Data/Containers.hs +4/−7
- tests/Instances/Data/Functor/Trans.hs +4/−8
- tests/Instances/Data/List/NonEmpty.hs +5/−7
- tests/Instances/Data/Semigroup.hs +5/−7
- tests/Instances/Data/String/UTF8.hs +4/−5
- tests/Instances/Data/Tagged.hs +1/−1
- tests/Instances/Language/Haskell/TH.hs +13/−11
- tests/Instances/Miscellaneous.hs +50/−16
- tests/Instances/System/Console/Haskeline.hs +4/−8
- tests/Instances/System/Console/Terminfo.hs +10/−5
- tests/Instances/System/Directory.hs +7/−5
- tests/Instances/System/Locale.hs +4/−6
- tests/Instances/System/Posix.hs +13/−10
- tests/Instances/System/Random.hs +5/−5
- tests/Instances/System/Win32.hs +10/−7
- tests/Instances/Text/PrettyPrint.hs +4/−9
- tests/Instances/Text/XHtml.hs +3/−7
- tests/Instances/Trace/Hpc.hs +4/−8
- tests/Instances/Utils.hs +1/−1
- tests/Properties.hs +0/−82
- tests/Properties/Compiler/Hoopl.hs +0/−40
- tests/Properties/Control/Applicative/Trans.hs +0/−31
- tests/Properties/Control/Monad/Trans.hs +0/−42
- tests/Properties/Data/Binary.hs +0/−29
- tests/Properties/Data/Containers.hs +0/−42
- tests/Properties/Data/Functor/Trans.hs +0/−37
- tests/Properties/Data/List/NonEmpty.hs +0/−29
- tests/Properties/Data/Semigroup.hs +0/−35
- tests/Properties/Data/String/UTF8.hs +0/−35
- tests/Properties/Data/Tagged.hs +0/−29
- tests/Properties/Data/Time.hs +0/−39
- tests/Properties/Data/UnorderedContainers.hs +0/−30
- tests/Properties/Language/Haskell/TH.hs +0/−100
- tests/Properties/System/Console/Haskeline.hs +0/−37
- tests/Properties/System/Console/Terminfo.hs +0/−30
- tests/Properties/System/Directory.hs +0/−35
- tests/Properties/System/Locale.hs +0/−29
- tests/Properties/System/Posix.hs +0/−35
- tests/Properties/System/Random.hs +0/−29
- tests/Properties/System/Time.hs +0/−32
- tests/Properties/System/Win32.hs +0/−41
- tests/Properties/Text/PrettyPrint.hs +0/−45
- tests/Properties/Text/XHtml.hs +0/−33
- tests/Properties/Trace/Hpc.hs +0/−37
- tests/Properties/Utils.hs +0/−24
- tests/Spec.hs +1/−0
- tests/Spec/Compiler/HooplSpec.hs +40/−0
- tests/Spec/Control/Applicative/TransSpec.hs +31/−0
- tests/Spec/Control/Monad/TransSpec.hs +42/−0
- tests/Spec/Data/BinarySpec.hs +29/−0
- tests/Spec/Data/ContainersSpec.hs +42/−0
- tests/Spec/Data/Functor/TransSpec.hs +37/−0
- tests/Spec/Data/List/NonEmptySpec.hs +29/−0
- tests/Spec/Data/SemigroupSpec.hs +35/−0
- tests/Spec/Data/String/UTF8Spec.hs +35/−0
- tests/Spec/Data/TaggedSpec.hs +29/−0
- tests/Spec/Data/TimeSpec.hs +39/−0
- tests/Spec/Data/UnorderedContainersSpec.hs +30/−0
- tests/Spec/Language/Haskell/THSpec.hs +99/−0
- tests/Spec/System/Console/HaskelineSpec.hs +36/−0
- tests/Spec/System/Console/TerminfoSpec.hs +43/−0
- tests/Spec/System/DirectorySpec.hs +42/−0
- tests/Spec/System/LocaleSpec.hs +29/−0
- tests/Spec/System/PosixSpec.hs +48/−0
- tests/Spec/System/RandomSpec.hs +29/−0
- tests/Spec/System/TimeSpec.hs +32/−0
- tests/Spec/System/Win32Spec.hs +54/−0
- tests/Spec/Text/PrettyPrintSpec.hs +45/−0
- tests/Spec/Text/XHtmlSpec.hs +33/−0
- tests/Spec/Trace/HpcSpec.hs +37/−0
- tests/Spec/Utils.hs +22/−0
- text-show-instances.cabal +63/−55
CHANGELOG.md view
@@ -1,3 +1,8 @@+# 0.4 +* Allow building with `text-show-0.8` +* Modules which were previously exported only if using a recent-enough version of GHC/`base` (e.g., `Text.Show.Text.System.Win32`) are now always exposed. If the functionality that the module provides is not available on a given version of GHC/`base`, the module will not expose anything. +* Change test-suite to use `hspec`, allowing for it to be built on GHC 7.0 and 7.2 + ### 0.3.0.1 * Fixed tests on Windows
− src/Text/Show/Text/Compiler.hs
@@ -1,13 +0,0 @@-{-| -Module: Text.Show.Text.Compiler -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -Imports 'Show' instances for @Compiler@ modules. --} -module Text.Show.Text.Compiler () where - -import Text.Show.Text.Compiler.Hoopl ()
src/Text/Show/Text/Compiler/Hoopl.hs view
@@ -37,9 +37,7 @@ #endif import Compiler.Hoopl.Passes.Dominator (DominatorNode(..), DominatorTree(..), DPath(..)) -#if !(MIN_VERSION_base(4,8,0)) -import Data.Monoid (mconcat) -#endif +import Data.Monoid.Compat import Prelude hiding (Show) @@ -47,7 +45,7 @@ import Text.Show.Text.Data.Containers () import Text.Show.Text.Data.Integral (showbIntPrec) import Text.Show.Text.TH (deriveShowPragmas, defaultInlineShowbPrec) -import Text.Show.Text.Utils ((<>), s) +import Text.Show.Text.Utils (s) #include "inline.h"
− src/Text/Show/Text/Control.hs
@@ -1,14 +0,0 @@-{-| -Module: Text.Show.Text.Control -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -Imports 'Show' instances for @Control@ modules. --} -module Text.Show.Text.Control () where - -import Text.Show.Text.Control.Applicative.Trans () -import Text.Show.Text.Control.Monad.Trans ()
− src/Text/Show/Text/Data.hs
@@ -1,22 +0,0 @@-{-| -Module: Text.Show.Text.Data -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -Imports 'Show' instances for @Data@ modules. --} -module Text.Show.Text.Data () where - -import Text.Show.Text.Data.Binary () -import Text.Show.Text.Data.Containers () -import Text.Show.Text.Data.Functor.Trans () -import Text.Show.Text.Data.List.NonEmpty () -import Text.Show.Text.Data.Semigroup () -import Text.Show.Text.Data.String.UTF8 () -import Text.Show.Text.Data.Tagged () -import Text.Show.Text.Data.Time () -import Text.Show.Text.Data.UnorderedContainers () -import Text.Show.Text.Data.Vector ()
src/Text/Show/Text/Data/Binary.hs view
@@ -16,11 +16,11 @@ module Text.Show.Text.Data.Binary (showbDecoder) where import Data.Binary.Get.Internal (Decoder(..)) +import Data.Monoid.Compat -import Prelude hiding (Show) +import Prelude () import Text.Show.Text (Show(showb, showbPrec), Show1(showbPrec1), Builder, fromString) -import Text.Show.Text.Utils ((<>)) #include "inline.h"
src/Text/Show/Text/Data/String/UTF8.hs view
@@ -20,9 +20,7 @@ import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BL -#if !(MIN_VERSION_base(4,8,0)) -import Data.Monoid (mempty) -#endif +import Data.Monoid.Compat import Data.String.UTF8 (UTF8, toRep) import Data.Word (Word8) @@ -30,7 +28,7 @@ import Text.Show.Text (Show(showb), Builder) import Text.Show.Text.Data.Text (showbBuilder) -import Text.Show.Text.Utils ((<>), s) +import Text.Show.Text.Utils (s) #include "inline.h"
src/Text/Show/Text/Data/Time.hs view
@@ -32,6 +32,7 @@ ) where import Data.Fixed (Pico) +import Data.Monoid.Compat import Data.Semigroup (timesN) import Data.Time.Calendar (Day, toGregorian) import Data.Time.Clock (DiffTime, UTCTime, NominalDiffTime) @@ -46,7 +47,7 @@ fromString, lengthB, showbSpace) import Text.Show.Text.Data.Fixed (showbFixed) import Text.Show.Text.Data.Integral () -import Text.Show.Text.Utils ((<>), s) +import Text.Show.Text.Utils (s) #if MIN_VERSION_time(1,5,0) import Data.Time.Format (TimeLocale)
src/Text/Show/Text/Instances.hs view
@@ -12,9 +12,32 @@ -} module Text.Show.Text.Instances () where -import Text.Show.Text.Compiler () -import Text.Show.Text.Data () -import Text.Show.Text.Language () -import Text.Show.Text.System () -import Text.Show.Text.Text () -import Text.Show.Text.Trace ()+import Text.Show.Text.Compiler.Hoopl () + +import Text.Show.Text.Control.Applicative.Trans () +import Text.Show.Text.Control.Monad.Trans () + +import Text.Show.Text.Data.Binary () +import Text.Show.Text.Data.Containers () +import Text.Show.Text.Data.Functor.Trans () +import Text.Show.Text.Data.List.NonEmpty () +import Text.Show.Text.Data.Semigroup () +import Text.Show.Text.Data.String.UTF8 () +import Text.Show.Text.Data.Tagged () +import Text.Show.Text.Data.Time () +import Text.Show.Text.Data.UnorderedContainers () +import Text.Show.Text.Data.Vector () + +import Text.Show.Text.Language.Haskell.TH () + +import Text.Show.Text.System.Console.Haskeline () +import Text.Show.Text.System.Console.Terminfo () +import Text.Show.Text.System.Locale () +import Text.Show.Text.System.Posix () +import Text.Show.Text.System.Random () +import Text.Show.Text.System.Time () +import Text.Show.Text.System.Win32 () + +import Text.Show.Text.Text.PrettyPrint () + +import Text.Show.Text.Trace.Hpc ()
− src/Text/Show/Text/Language.hs
@@ -1,13 +0,0 @@-{-| -Module: Text.Show.Text.Language -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -Imports 'Show' instances for @Language@ modules. --} -module Text.Show.Text.Language () where - -import Text.Show.Text.Language.Haskell.TH ()
src/Text/Show/Text/Language/Haskell/TH.hs view
@@ -87,6 +87,7 @@ import Data.Char (isAlpha) import Data.Maybe (fromJust) +import Data.Monoid.Compat import qualified Data.Text.Lazy as TL (Text, dropWhile, null, tail) import Data.Text.Lazy (uncons) @@ -104,7 +105,7 @@ import Text.Show.Text.Data.Integral (showbIntPrec) import Text.Show.Text.Text.PrettyPrint (renderB) import Text.Show.Text.TH (deriveShow) -import Text.Show.Text.Utils ((<>), s) +import Text.Show.Text.Utils (s) -- | Convert a 'Body' to a 'Builder' with the given precedence. --
− src/Text/Show/Text/System.hs
@@ -1,24 +0,0 @@-{-# LANGUAGE CPP #-} -{-| -Module: Text.Show.Text.System -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -Imports 'Show' instances for @System@ modules. --} -module Text.Show.Text.System () where - -import Text.Show.Text.System.Console.Haskeline () -import Text.Show.Text.System.Locale () -import Text.Show.Text.System.Random () -import Text.Show.Text.System.Time () - -#if defined(mingw32_HOST_OS) -import Text.Show.Text.System.Win32 () -#else -import Text.Show.Text.System.Console.Terminfo () -import Text.Show.Text.System.Posix () -#endif
src/Text/Show/Text/System/Console/Terminfo.hs view
@@ -1,6 +1,10 @@ {-# LANGUAGE CPP #-} + +#if !defined(mingw32_HOST_OS) {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-orphans #-} +#endif + {-| Module: Text.Show.Text.System.Console.Terminfo Copyright: (C) 2014-2015 Ryan Scott @@ -9,11 +13,18 @@ Stability: Experimental Portability: GHC -Monomorphic 'Show' functions for data types in the @terminfo@ library. +Monomorphic 'Show' functions for data types in the @terminfo@ library. This module +only exports functions if using a Unix-like operating system (i.e., not Windows). /Since: 0.2/ -} -module Text.Show.Text.System.Console.Terminfo (showbColorPrec, showbSetupTermError) where +module Text.Show.Text.System.Console.Terminfo ( +#if defined(mingw32_HOST_OS) + ) where +#else + showbColorPrec + , showbSetupTermError + ) where import Prelude hiding (Show) @@ -44,3 +55,4 @@ instance Show SetupTermError where showb = showbSetupTermError INLINE_INST_FUN(showb) +#endif
src/Text/Show/Text/System/Posix.hs view
@@ -1,5 +1,10 @@+{-# LANGUAGE CPP #-} + +#if !defined(mingw32_HOST_OS) {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-orphans #-} +#endif + {-| Module: Text.Show.Text.System.Posix Copyright: (C) 2014-2015 Ryan Scott @@ -8,12 +13,15 @@ Stability: Experimental Portability: GHC -Monomorphic 'Show' functions for data types in the @unix@ library. This module is -only available on Unix-like operating systems (i.e., not Windows). +Monomorphic 'Show' functions for data types in the @unix@ library. This module +only exports functions if using a Unix-like operating system (i.e., not Windows). /Since: 0.1/ -} module Text.Show.Text.System.Posix ( +#if defined(mingw32_HOST_OS) + ) where +#else showbRTLDFlags , showbDLPrec , showbProcessStatusPrec @@ -67,4 +75,5 @@ $(deriveShow ''DL) $(deriveShow ''ProcessStatus) $(deriveShow ''GroupEntry) -$(deriveShow ''UserEntry)+$(deriveShow ''UserEntry) +#endif
src/Text/Show/Text/System/Win32.hs view
@@ -1,5 +1,10 @@+{-# LANGUAGE CPP #-} + +#if defined(mingw32_HOST_OS) {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -fno-warn-orphans #-} +#endif + {-| Module: Text.Show.Text.System.Win32 Copyright: (C) 2014-2015 Ryan Scott @@ -9,11 +14,14 @@ Portability: GHC Monomorphic 'Show' functions for data types in the @Win32@ library. -This module is only available on Windows. +This module only exports functions if using Windows. /Since: 0.1/ -} module Text.Show.Text.System.Win32 ( +#if !defined(mingw32_HOST_OS) + ) where +#else showbDebugEventInfoPrec , showbExceptionPrec , showb_BY_HANDLE_FILE_INFORMATION_Prec @@ -114,4 +122,5 @@ $(deriveShowPragmas defaultInlineShowbPrec ''FILETIME) $(deriveShow ''SYSTEMTIME) $(deriveShow ''TIME_ZONE_INFORMATION) -$(deriveShowPragmas defaultInlineShowb ''TimeZoneId)+$(deriveShowPragmas defaultInlineShowb ''TimeZoneId) +#endif
− src/Text/Show/Text/Text.hs
@@ -1,13 +0,0 @@-{-| -Module: Text.Show.Text.Text -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -Imports 'Show' instances for @Text@ modules. --} -module Text.Show.Text.Text () where - -import Text.Show.Text.Text.PrettyPrint ()
src/Text/Show/Text/Text/PrettyPrint.hs view
@@ -24,9 +24,7 @@ #endif ) where -#if !(MIN_VERSION_base(4,8,0)) -import Data.Monoid (mempty) -#endif +import Data.Monoid.Compat import Prelude hiding (Show) @@ -38,7 +36,7 @@ #endif import Text.Show.Text (Show(showb, showbPrec), Builder, fromString) import Text.Show.Text.TH (deriveShow, deriveShowPragmas, defaultInlineShowb) -import Text.Show.Text.Utils ((<>), s) +import Text.Show.Text.Utils (s) #include "inline.h"
src/Text/Show/Text/Text/XHtml.hs view
@@ -21,16 +21,14 @@ , showbHtmlTable ) where -#if !(MIN_VERSION_base(4,8,0)) -import Data.Monoid (mconcat) -#endif +import Data.Monoid.Compat import Prelude hiding (Show) import Text.Show.Text (Show(..), Builder, FromStringShow(..), fromString) import Text.Show.Text.Data.Char (showbString) import Text.Show.Text.TH (deriveShow) -import Text.Show.Text.Utils ((<>), s) +import Text.Show.Text.Utils (s) import Text.XHtml.Frameset (Html, HtmlAttr, HotLink, htmlAttrPair, renderHtmlFragment) import Text.XHtml.Table (HtmlTable)
− src/Text/Show/Text/Trace.hs
@@ -1,13 +0,0 @@-{-| -Module: Text.Show.Text.Trace -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -Imports 'Show' instances for @Trace@ modules. --} -module Text.Show.Text.Trace () where - -import Text.Show.Text.Trace.Hpc ()
src/Text/Show/Text/Trace/Hpc.hs view
@@ -23,6 +23,8 @@ , showbHash ) where +import Data.Monoid.Compat + import Prelude hiding (Show) import Text.Show.Text (Show(showb, showbPrec), Builder, FromStringShow(..)) @@ -30,7 +32,7 @@ import Text.Show.Text.Data.Time () import Text.Show.Text.TH (deriveShow, deriveShowPragmas, defaultInlineShowb, defaultInlineShowbPrec) -import Text.Show.Text.Utils ((<>), s) +import Text.Show.Text.Utils (s) import Trace.Hpc.Mix (Mix, BoxLabel, CondBox) import Trace.Hpc.Tix (Tix, TixModule)
src/Text/Show/Text/Utils.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-| Module: Text.Show.Text.Utils @@ -12,19 +11,8 @@ -} module Text.Show.Text.Utils where -#if !(MIN_VERSION_base(4,8,0)) -import Data.Monoid (Monoid(mappend)) -#endif import Prelude hiding (Show) import Text.Show.Text (Show, Builder, showbUnary, singleton) - -infixr 6 <> - --- | Infix 'mappend', defined here for backwards-compatibility with older versions --- of @base@. -(<>) :: Monoid m => m -> m -> m -(<>) = mappend -{-# INLINE (<>) #-} -- | A shorter name for 'singleton' for convenience's sake (since it tends to be used -- pretty often in @text-show-instances@).
tests/Instances/Compiler/Hoopl.hs view
@@ -25,15 +25,12 @@ #endif import Compiler.Hoopl.Passes.Dominator (DominatorNode(..), DominatorTree(..), DPath(..)) -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative (pure) - -import Data.Functor ((<$>)) -#endif - import Instances.Utils ((<@>)) -import Test.Tasty.QuickCheck (Arbitrary(..), oneof) +import Prelude () +import Prelude.Compat + +import Test.QuickCheck (Arbitrary(..), oneof) instance Arbitrary Label where arbitrary = uniqueToLbl <$> arbitrary
tests/Instances/Control/Applicative/Trans.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} @@ -18,11 +17,10 @@ import Control.Applicative.Backwards (Backwards(..)) import Control.Applicative.Lift (Lift(..)) -#if !(MIN_VERSION_base(4,8,0)) -import Data.Functor ((<$>)) -#endif +import Prelude () +import Prelude.Compat -import Test.Tasty.QuickCheck (Arbitrary(..), oneof) +import Test.QuickCheck (Arbitrary(..), oneof) deriving instance Arbitrary (f a) => Arbitrary (Backwards f a)
tests/Instances/Control/Monad/Trans.hs view
@@ -24,7 +24,7 @@ import qualified Control.Monad.Trans.Writer.Lazy as WL (WriterT(..)) import qualified Control.Monad.Trans.Writer.Strict as WS (WriterT(..)) -import Test.Tasty.QuickCheck (Arbitrary) +import Test.QuickCheck (Arbitrary) deriving instance Arbitrary (m (Either e a)) => Arbitrary (ErrorT e m a) deriving instance Arbitrary (m (Either e a)) => Arbitrary (ExceptT e m a)
tests/Instances/Data/Binary.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.Data.Binary @@ -12,16 +11,13 @@ -} module Instances.Data.Binary () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>)) - -import Data.Functor ((<$>)) -#endif - import Data.Binary.Get.Internal (Decoder(..)) +import Prelude () +import Prelude.Compat + +import Test.QuickCheck (Arbitrary(..), oneof) import Test.QuickCheck.Instances () -import Test.Tasty.QuickCheck (Arbitrary(..), oneof) instance Arbitrary a => Arbitrary (Decoder a) where arbitrary = oneof [ Fail <$> arbitrary <*> arbitrary
tests/Instances/Data/Containers.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.Data.Containers @@ -12,15 +11,13 @@ -} module Instances.Data.Containers () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>), pure) -import Data.Functor ((<$>)) -#endif - import Data.Sequence (ViewL(..), ViewR(..)) +import Prelude () +import Prelude.Compat + +import Test.QuickCheck (Arbitrary(..), oneof) import Test.QuickCheck.Instances () -import Test.Tasty.QuickCheck (Arbitrary(..), oneof) instance Arbitrary a => Arbitrary (ViewL a) where arbitrary = oneof [pure EmptyL, (:<) <$> arbitrary <*> arbitrary]
tests/Instances/Data/Functor/Trans.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} @@ -15,19 +14,16 @@ -} module Instances.Data.Functor.Trans () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>)) - -import Data.Functor ((<$>)) -#endif - import Data.Functor.Compose (Compose(..)) import Data.Functor.Constant (Constant(..)) import Data.Functor.Product (Product(..)) import Data.Functor.Reverse (Reverse(..)) import Data.Functor.Sum (Sum(..)) -import Test.Tasty.QuickCheck (Arbitrary(..), oneof) +import Prelude () +import Prelude.Compat + +import Test.QuickCheck (Arbitrary(..), oneof) deriving instance Arbitrary (f (g a)) => Arbitrary (Compose f g a) deriving instance Arbitrary a => Arbitrary (Constant a b)
tests/Instances/Data/List/NonEmpty.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.Data.List.NonEmpty @@ -12,13 +11,12 @@ -} module Instances.Data.List.NonEmpty () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>)) -import Data.Functor ((<$>)) -#endif - import Data.List.NonEmpty (NonEmpty(..)) -import Test.Tasty.QuickCheck (Arbitrary(..)) + +import Prelude () +import Prelude.Compat + +import Test.QuickCheck (Arbitrary(..)) instance Arbitrary a => Arbitrary (NonEmpty a) where arbitrary = (:|) <$> arbitrary <*> arbitrary
tests/Instances/Data/Semigroup.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} @@ -14,14 +13,13 @@ -} module Instances.Data.Semigroup () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>)) -import Data.Functor ((<$>)) -#endif - import Data.Semigroup (Min(..), Max(..), First(..), Last(..), WrappedMonoid(..), Option(..), Arg(..)) -import Test.Tasty.QuickCheck (Arbitrary(..)) + +import Prelude () +import Prelude.Compat + +import Test.QuickCheck (Arbitrary(..)) deriving instance Arbitrary a => Arbitrary (Min a) deriving instance Arbitrary a => Arbitrary (Max a)
tests/Instances/Data/String/UTF8.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.Data.String.UTF8 @@ -12,12 +11,12 @@ -} module Instances.Data.String.UTF8 () where -#if !(MIN_VERSION_base(4,8,0)) -import Data.Functor ((<$>)) -#endif import Data.String.UTF8 (UTF8, fromRep) -import Test.Tasty.QuickCheck (Arbitrary(..)) +import Prelude () +import Prelude.Compat + +import Test.QuickCheck (Arbitrary(..)) instance Arbitrary a => Arbitrary (UTF8 a) where arbitrary = fromRep <$> arbitrary
tests/Instances/Data/Tagged.hs view
@@ -14,6 +14,6 @@ module Instances.Data.Tagged () where import Data.Tagged (Tagged(..)) -import Test.Tasty.QuickCheck (Arbitrary) +import Test.QuickCheck (Arbitrary) deriving instance Arbitrary b => Arbitrary (Tagged s b)
tests/Instances/Language/Haskell/TH.hs view
@@ -1,11 +1,9 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MagicHash #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeSynonymInstances #-} -#if !(MIN_VERSION_template_haskell(2,10,0)) -{-# LANGUAGE MagicHash #-} -#endif {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.Language.Haskell.TH @@ -19,12 +17,6 @@ -} module Instances.Language.Haskell.TH () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>), pure) - -import Data.Functor ((<$>)) -#endif - #if !(MIN_VERSION_template_haskell(2,10,0)) import GHC.Exts (Int(I#)) #endif @@ -37,8 +29,11 @@ import Language.Haskell.TH.Syntax.Internals #endif -import Test.Tasty.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) +import Prelude () +import Prelude.Compat +import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) + instance Arbitrary Body where arbitrary = oneof $ map pure [ GuardedB [(fGuard, fExp)] , NormalB fExp @@ -227,8 +222,10 @@ instance Arbitrary Info where arbitrary = oneof [ -#if MIN_VERSION_template_haskell(2,5,0) +#if MIN_VERSION_template_haskell(2,7,0) pure $ ClassI fDec [fDec] +#elif MIN_VERSION_template_haskell(2,5,0) + pure $ ClassI fDec [fClassInstance] #else pure $ ClassI fDec #endif @@ -560,6 +557,11 @@ fBody :: Body fBody = GuardedB [] + +#if MIN_VERSION_template_haskell(2,5,0) && !MIN_VERSION_template_haskell(2,7,0) +fClassInstance :: ClassInstance +fClassInstance = ClassInstance fName [fTyVarBndr] [fPred] fName [fType] +#endif fClause :: Clause fClause = Clause [] fBody []
tests/Instances/Miscellaneous.hs view
@@ -16,27 +16,40 @@ #include "HsBaseConfig.h" -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative (pure) - -import Data.Functor ((<$>)) -#endif - import Data.Version (Version(..)) -import Foreign.C.Types (CInt(..)) import Foreign.Ptr (Ptr, nullPtr, plusPtr) +import Prelude () +import Prelude.Compat + import System.Exit (ExitCode(..)) -#if defined(HTYPE_GID_T) + +import Test.QuickCheck (Arbitrary(..), oneof) + +#if MIN_VERSION_base(4,5,0) + +import Foreign.C.Types (CInt(..)) +# if defined(HTYPE_GID_T) import System.Posix.Types (CGid(..)) -#endif -#if defined(HTYPE_UID_T) +# endif +# if defined(HTYPE_UID_T) import System.Posix.Types (CUid(..)) -#endif +# endif -import Test.Tasty.QuickCheck (Arbitrary(..), oneof) +#else +import Foreign.C.Types (CInt) +# if defined(HTYPE_GID_T) +import System.Posix.Types (CGid) +# endif +# if defined(HTYPE_UID_T) +import System.Posix.Types (CUid) +# endif +import Test.QuickCheck (arbitrarySizedBoundedIntegral) + +#endif + instance Arbitrary ExitCode where arbitrary = oneof [pure ExitSuccess, ExitFailure <$> arbitrary] @@ -47,10 +60,31 @@ arbitrary = pure $ Version [0] [""] -- arbitrary = Version <$> arbitrary <*> arbitrary +#if MIN_VERSION_base(4,5,0) + deriving instance Arbitrary CInt -#if defined(HTYPE_GID_T) + +# if defined(HTYPE_GID_T) deriving instance Arbitrary CGid -#endif -#if defined(HTYPE_UID_T) +# endif + +# if defined(HTYPE_UID_T) deriving instance Arbitrary CUid -#endif +# endif + +#else + +instance Arbitrary CInt where + arbitrary = arbitrarySizedBoundedIntegral + +# if defined(HTYPE_GID_T) +instance Arbitrary CGid where + arbitrary = arbitrarySizedBoundedIntegral +# endif + +# if defined(HTYPE_UID_T) +instance Arbitrary CUid where + arbitrary = arbitrarySizedBoundedIntegral +# endif + +#endif
tests/Instances/System/Console/Haskeline.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.System.Console.Haskeline @@ -12,19 +11,16 @@ -} module Instances.System.Console.Haskeline () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>), pure) - -import Data.Functor ((<$>)) -#endif - import Instances.Utils ((<@>)) +import Prelude () +import Prelude.Compat + import System.Console.Haskeline (Interrupt(..)) import System.Console.Haskeline.Completion (Completion(..)) import System.Console.Haskeline.History (History, addHistory, emptyHistory) -import Test.Tasty.QuickCheck (Arbitrary(..)) +import Test.QuickCheck (Arbitrary(..)) instance Arbitrary Interrupt where arbitrary = pure Interrupt
tests/Instances/System/Console/Terminfo.hs view
@@ -1,5 +1,9 @@ {-# LANGUAGE CPP #-} + +#if !defined(mingw32_HOST_OS) {-# OPTIONS_GHC -fno-warn-orphans #-} +#endif + {-| Module: Instances.System.Console.Terminfo Copyright: (C) 2014-2015 Ryan Scott @@ -12,14 +16,14 @@ -} module Instances.System.Console.Terminfo () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative (pure) -import Data.Functor ((<$>)) -#endif +#if !defined(mingw32_HOST_OS) +import Prelude () +import Prelude.Compat import System.Console.Terminfo.Color (Color(..)) -import Test.Tasty.QuickCheck (Arbitrary(..), oneof) +import Test.QuickCheck (Arbitrary(..), oneof) + instance Arbitrary Color where arbitrary = oneof [ pure Black , pure Red @@ -33,3 +37,4 @@ ] -- instance Arbitrary SetupTermError +#endif
tests/Instances/System/Directory.hs view
@@ -14,12 +14,14 @@ #if MIN_VERSION_directory(1,1,0) import Control.Applicative ((<**>)) -# if !(MIN_VERSION_base(4,8,0)) -import Data.Functor ((<$>)) -# endif + +import Prelude () +import Prelude.Compat + import System.Directory (Permissions, emptyPermissions, setOwnerReadable, - setOwnerWritable, setOwnerExecutable, setOwnerSearchable) -import Test.Tasty.QuickCheck (Arbitrary(..)) + setOwnerWritable, setOwnerExecutable, setOwnerSearchable) + +import Test.QuickCheck (Arbitrary(..)) instance Arbitrary Permissions where arbitrary = ($ emptyPermissions) <$> (setOwnerReadable <$> arbitrary)
tests/Instances/System/Locale.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.System.Locale @@ -12,13 +11,12 @@ -} module Instances.System.Locale () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>)) -import Data.Functor ((<$>)) -#endif +import Prelude () +import Prelude.Compat import System.Locale (TimeLocale(..)) -import Test.Tasty.QuickCheck (Arbitrary(..)) + +import Test.QuickCheck (Arbitrary(..)) instance Arbitrary TimeLocale where arbitrary = TimeLocale <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
tests/Instances/System/Posix.hs view
@@ -1,6 +1,10 @@ {-# LANGUAGE CPP #-} + +#if !defined(mingw32_HOST_OS) {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} +#endif + {-| Module: Instances.System.Posix Copyright: (C) 2014-2015 Ryan Scott @@ -13,19 +17,17 @@ -} module Instances.System.Posix () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>), pure) - -import Data.Functor ((<$>)) -#endif - +#if !defined(mingw32_HOST_OS) import Instances.Miscellaneous () +import Prelude () +import Prelude.Compat + import System.Posix.DynamicLinker (RTLDFlags(..), DL(..)) import System.Posix.Process (ProcessStatus(..)) import System.Posix.User (GroupEntry(..), UserEntry(..)) -import Test.Tasty.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) +import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) deriving instance Bounded RTLDFlags deriving instance Enum RTLDFlags @@ -37,11 +39,11 @@ instance Arbitrary ProcessStatus where arbitrary = oneof [ Exited <$> arbitrary -#if MIN_VERSION_unix(2,7,0) +# if MIN_VERSION_unix(2,7,0) , Terminated <$> arbitrary <*> arbitrary -#else +# else , Terminated <$> arbitrary -#endif +# endif , Stopped <$> arbitrary ] @@ -51,3 +53,4 @@ instance Arbitrary UserEntry where arbitrary = UserEntry <$> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary <*> arbitrary +#endif
tests/Instances/System/Random.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.System.Random @@ -12,11 +11,12 @@ -} module Instances.System.Random () where -#if !(MIN_VERSION_base(4,8,0)) -import Data.Functor ((<$>)) -#endif +import Prelude () +import Prelude.Compat + import System.Random (StdGen, mkStdGen) -import Test.Tasty.QuickCheck (Arbitrary(..)) + +import Test.QuickCheck (Arbitrary(..)) instance Arbitrary StdGen where arbitrary = mkStdGen <$> arbitrary
tests/Instances/System/Win32.hs view
@@ -1,7 +1,11 @@ {-# LANGUAGE CPP #-} + +#if defined(mingw32_HOST_OS) {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} +#endif + {-| Module: Instances.System.Win32 Copyright: (C) 2014-2015 Ryan Scott @@ -14,21 +18,19 @@ -} module Instances.System.Win32 () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>), pure) - -import Data.Functor ((<$>)) -#endif - +#if defined(mingw32_HOST_OS) import Instances.Miscellaneous () +import Prelude () +import Prelude.Compat + import System.Win32.DebugApi (DebugEventInfo(..), Exception(..)) import System.Win32.File (BY_HANDLE_FILE_INFORMATION(..), WIN32_FILE_ATTRIBUTE_DATA(..)) import System.Win32.Info (ProcessorArchitecture(..), SYSTEM_INFO(..)) import System.Win32.Time (FILETIME(..), SYSTEMTIME(..), TIME_ZONE_INFORMATION(..), TimeZoneId(..)) -import Test.Tasty.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) +import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) instance Arbitrary DebugEventInfo where arbitrary = oneof [ pure UnknownDebugEvent @@ -104,3 +106,4 @@ deriving instance Enum TimeZoneId instance Arbitrary TimeZoneId where arbitrary = arbitraryBoundedEnum +#endif
tests/Instances/Text/PrettyPrint.hs view
@@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE StandaloneDeriving #-} -#if MIN_VERSION_pretty(1,1,2) {-# LANGUAGE GeneralizedNewtypeDeriving #-} -#endif +{-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.Text.PrettyPrint @@ -17,13 +15,10 @@ -} module Instances.Text.PrettyPrint () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>)) - -import Data.Functor ((<$>)) -#endif +import Prelude () +import Prelude.Compat -import Test.Tasty.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) +import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) import Text.PrettyPrint.HughesPJ (Doc, Mode(..), Style(..), TextDetails(..), text) #if MIN_VERSION_pretty(1,1,2)
tests/Instances/Text/XHtml.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| Module: Instances.Text.XHtml @@ -12,13 +11,10 @@ -} module Instances.Text.XHtml () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>)) - -import Data.Functor ((<$>)) -#endif +import Prelude () +import Prelude.Compat -import Test.Tasty.QuickCheck (Arbitrary(..), Gen) +import Test.QuickCheck (Arbitrary(..), Gen) import Text.XHtml.Frameset (Html, HtmlAttr, HotLink(..), strAttr, toHtml) import Text.XHtml.Table (HtmlTable, cell)
tests/Instances/Trace/Hpc.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-| @@ -13,16 +12,13 @@ -} module Instances.Trace.Hpc () where -#if !(MIN_VERSION_base(4,8,0)) -import Control.Applicative ((<*>)) - -import Data.Functor ((<$>)) -#endif - import Instances.Utils ((<@>)) +import Prelude () +import Prelude.Compat + +import Test.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) import Test.QuickCheck.Instances () -import Test.Tasty.QuickCheck (Arbitrary(..), arbitraryBoundedEnum, oneof) import Trace.Hpc.Mix (Mix(..), MixEntry, BoxLabel(..), CondBox(..)) import Trace.Hpc.Tix (Tix(..), TixModule(..))
tests/Instances/Utils.hs view
@@ -13,4 +13,4 @@ infixl 4 <@> -- | A useful way to escape a 'Functor' context. (<@>) :: Functor f => f (a -> b) -> a -> f b -f <@> x = fmap ($ x) f+f <@> x = fmap ($ x) f
− tests/Properties.hs
@@ -1,82 +0,0 @@-{-# LANGUAGE CPP #-} -{-| -Module: Properties -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ tests for @text-show-instances@. --} -module Main (main) where - -import Properties.Compiler.Hoopl (hooplTests) -import Properties.Control.Applicative.Trans (applicativeFunctorTransformerTests) -import Properties.Control.Monad.Trans (monadTransformerTests) -import Properties.Data.Binary (binaryTests) -import Properties.Data.Containers (containersTests) -import Properties.Data.Functor.Trans (functorTransformerTests) -import Properties.Data.List.NonEmpty (nonEmptyListTests) -import Properties.Data.Semigroup (semigroupTests) -import Properties.Data.String.UTF8 (utf8StringTests) -import Properties.Data.Tagged (taggedTests) -import Properties.Data.Time (timeTests) -import Properties.Data.UnorderedContainers (unorderedContainersTests) -import Properties.Data.Vector (vectorTests) -import Properties.Language.Haskell.TH (templateHaskellTests) -import Properties.System.Console.Haskeline (haskelineTests) -import Properties.System.Directory (directoryTests) -import Properties.System.Locale (oldLocaleTests) -#if !defined(mingw32_HOST_OS) -import Properties.System.Console.Terminfo (terminfoTests) -import Properties.System.Posix (unixTests) -#endif -import Properties.System.Random (randomTests) -import Properties.System.Time (oldTimeTests) -#if defined(mingw32_HOST_OS) -import Properties.System.Win32 (win32Tests) -#endif -import Properties.Text.PrettyPrint (prettyTests) -import Properties.Text.XHtml (xhtmlTests) -import Properties.Trace.Hpc (hpcTests) - -import Test.Tasty (TestTree, defaultMain, testGroup) - -main :: IO () -main = defaultMain testTree - -testTree :: TestTree -testTree = testGroup "QuickCheck properties" allTests - -allTests :: [TestTree] -allTests = concat [ hooplTests - , applicativeFunctorTransformerTests - , monadTransformerTests - , binaryTests - , containersTests - , functorTransformerTests - , nonEmptyListTests - , semigroupTests - , utf8StringTests - , taggedTests - , timeTests - , unorderedContainersTests - , vectorTests - , templateHaskellTests - , haskelineTests - , directoryTests - , oldLocaleTests -#if !defined(mingw32_HOST_OS) - , terminfoTests - , unixTests -#endif - , randomTests - , oldTimeTests -#if defined(mingw32_HOST_OS) - , win32Tests -#endif - , prettyTests - , xhtmlTests - , hpcTests - ]
− tests/Properties/Compiler/Hoopl.hs
@@ -1,40 +0,0 @@-{-| -Module: Properties.Compiler.Hoopl -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @hoopl@ library. --} -module Properties.Compiler.Hoopl (hooplTests) where - -import Compiler.Hoopl (Label, LabelMap, LabelSet, Pointed, - Unique, UniqueMap, UniqueSet, C) -import Compiler.Hoopl.Passes.Dominator (DominatorNode, DominatorTree, DPath) - -import Instances.Compiler.Hoopl () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Compiler.Hoopl () - -hooplTests :: [TestTree] -hooplTests = - [ testGroup "Text.Show.Text.Compiler.Hoopl" - [ testProperty "Label instance" (prop_matchesShow :: Int -> Label -> Bool) - , testProperty "LabelMap Char instance" (prop_matchesShow :: Int -> LabelMap Char -> Bool) - , testProperty "LabelSet instance" (prop_matchesShow :: Int -> LabelSet -> Bool) - , testProperty "Pointed C C Int instance" (prop_matchesShow :: Int -> Pointed C C Int -> Bool) - , testProperty "Unique instance" (prop_matchesShow :: Int -> Unique -> Bool) - , testProperty "UniqueMap Char instance" (prop_matchesShow :: Int -> UniqueMap Char -> Bool) - , testProperty "UniqueSet instance" (prop_matchesShow :: Int -> UniqueSet -> Bool) - , testProperty "DominatorNode instance" (prop_matchesShow :: Int -> DominatorNode -> Bool) - , testProperty "DominatorTree instance" (prop_matchesShow :: Int -> DominatorTree -> Bool) - , testProperty "DPath instance" (prop_matchesShow :: Int -> DPath -> Bool) - ] - ]
− tests/Properties/Control/Applicative/Trans.hs
@@ -1,31 +0,0 @@-{-| -Module: Properties.Control.Applicative.Trans -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for applicative functor transformers. --} -module Properties.Control.Applicative.Trans (applicativeFunctorTransformerTests) where - -import Control.Applicative.Backwards (Backwards) -import Control.Applicative.Lift (Lift) - -import Instances.Control.Applicative.Trans () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Control.Applicative.Trans () - -applicativeFunctorTransformerTests :: [TestTree] -applicativeFunctorTransformerTests = - [ testGroup "Text.Show.Text.Control.Applicative.Trans" - [ testProperty "Backwards Maybe Int instance" (prop_matchesShow :: Int -> Backwards Maybe Int -> Bool) - , testProperty "Lift Maybe Int instance" (prop_matchesShow :: Int -> Lift Maybe Int -> Bool) - ] - ]
− tests/Properties/Control/Monad/Trans.hs
@@ -1,42 +0,0 @@-{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} -{-| -Module: Properties.Control.Monad.Trans -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for monad transformers. --} -module Properties.Control.Monad.Trans (monadTransformerTests) where - -import Control.Monad.Trans.Error (ErrorT) -import Control.Monad.Trans.Except (ExceptT) -import Control.Monad.Trans.Identity (IdentityT) -import Control.Monad.Trans.List (ListT) -import Control.Monad.Trans.Maybe (MaybeT) -import qualified Control.Monad.Trans.Writer.Lazy as WL (WriterT) -import qualified Control.Monad.Trans.Writer.Strict as WS (WriterT) - -import Instances.Control.Monad.Trans () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Control.Monad.Trans () - -monadTransformerTests :: [TestTree] -monadTransformerTests = - [ testGroup "Text.Show.Text.Control.Monad.Trans" - [ testProperty "ErrorT Char Maybe Int instance" (prop_matchesShow :: Int -> ErrorT Char Maybe Int -> Bool) - , testProperty "ExceptT Char Maybe Int instance" (prop_matchesShow :: Int -> ExceptT Char Maybe Int -> Bool) - , testProperty "IdentityT Maybe Int instance" (prop_matchesShow :: Int -> IdentityT Maybe Int -> Bool) - , testProperty "ListT Maybe Char instance" (prop_matchesShow :: Int -> ListT Maybe Char -> Bool) - , testProperty "Maybe [] Int instance" (prop_matchesShow :: Int -> MaybeT [] Int -> Bool) - , testProperty "lazy WriterT String Maybe Int instance" (prop_matchesShow :: Int -> WL.WriterT String Maybe Int -> Bool) - , testProperty "strict WriterT String Maybe Int instance" (prop_matchesShow :: Int -> WS.WriterT String Maybe Int -> Bool) - ] - ]
− tests/Properties/Data/Binary.hs
@@ -1,29 +0,0 @@-{-| -Module: Properties.Data.Binary -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for 'Decoder's. --} -module Properties.Data.Binary (binaryTests) where - -import Data.Binary.Get.Internal (Decoder) - -import Instances.Data.Binary () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.Binary () - -binaryTests :: [TestTree] -binaryTests = - [ testGroup "Text.Show.Text.Data.Binary" - [ testProperty "Decoder Int instance" (prop_matchesShow :: Int -> Decoder Int -> Bool) - ] - ]
− tests/Properties/Data/Containers.hs
@@ -1,42 +0,0 @@-{-| -Module: Properties.Data.Containers -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @containers@ library. --} -module Properties.Data.Containers (containersTests) where - -import Data.IntMap (IntMap) -import Data.IntSet (IntSet) -import Data.Map (Map) -import Data.Sequence (Seq, ViewL, ViewR) -import Data.Set (Set) -import Data.Tree (Tree) - -import Instances.Data.Containers () - -import Properties.Utils (prop_matchesShow) - -import Test.QuickCheck.Instances () -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.Containers () - -containersTests :: [TestTree] -containersTests = - [ testGroup "Text.Show.Text.Data.Containers" - [ testProperty "IntMap Char instance" (prop_matchesShow :: Int -> IntMap Char -> Bool) - , testProperty "IntSet instance" (prop_matchesShow :: Int -> IntSet -> Bool) - , testProperty "Map Char Char instance" (prop_matchesShow :: Int -> Map Char Char -> Bool) - , testProperty "Sequence Char" (prop_matchesShow :: Int -> Seq Char -> Bool) - , testProperty "ViewL Int instance" (prop_matchesShow :: Int -> ViewL Int -> Bool) - , testProperty "ViewR Int instance" (prop_matchesShow :: Int -> ViewR Int -> Bool) - , testProperty "Set Char instance" (prop_matchesShow :: Int -> Set Char -> Bool) - , testProperty "Tree Char instance" (prop_matchesShow :: Int -> Tree Char -> Bool) - ] - ]
− tests/Properties/Data/Functor/Trans.hs
@@ -1,37 +0,0 @@-{-| -Module: Properties.Data.Functor.Trans -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for functor transformers. --} -module Properties.Data.Functor.Trans (functorTransformerTests) where - -import Data.Functor.Compose (Compose) -import Data.Functor.Constant (Constant) -import Data.Functor.Product (Product) -import Data.Functor.Reverse (Reverse) -import Data.Functor.Sum (Sum) - -import Instances.Data.Functor.Trans () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.Functor.Trans () - -functorTransformerTests :: [TestTree] -functorTransformerTests = - [ testGroup "Text.Show.Text.Data.Functor.Trans" - [ testProperty "Compose Maybe [] Char instance" (prop_matchesShow :: Int -> Compose Maybe [] Char -> Bool) - , testProperty "Constant Int Char instance" (prop_matchesShow :: Int -> Constant Int Char -> Bool) - , testProperty "Product Maybe [] Char instance" (prop_matchesShow :: Int -> Product Maybe [] Char -> Bool) - , testProperty "Reverse Maybe Int instance" (prop_matchesShow :: Int -> Reverse Maybe Int -> Bool) - , testProperty "Sum Maybe [] Char instance" (prop_matchesShow :: Int -> Sum Maybe [] Char -> Bool) - ] - ]
− tests/Properties/Data/List/NonEmpty.hs
@@ -1,29 +0,0 @@-{-| -Module: Properties.Data.List.NonEmpty -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for 'NonEmpty' lists. --} -module Properties.Data.List.NonEmpty (nonEmptyListTests) where - -import Data.List.NonEmpty (NonEmpty) - -import Instances.Data.List.NonEmpty () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.List.NonEmpty () - -nonEmptyListTests :: [TestTree] -nonEmptyListTests = - [ testGroup "Text.Show.Text.Data.List.NonEmpty" - [ testProperty "NonEmpty Char instance" (prop_matchesShow :: Int -> NonEmpty Char -> Bool) - ] - ]
− tests/Properties/Data/Semigroup.hs
@@ -1,35 +0,0 @@-{-| -Module: Properties.Data.Semigroup -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for @Semigroup@ data types. --} -module Properties.Data.Semigroup (semigroupTests) where - -import Data.Semigroup (Min, Max, First, Last, WrappedMonoid, Option, Arg) - -import Instances.Data.Semigroup () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.Semigroup () - -semigroupTests :: [TestTree] -semigroupTests = - [ testGroup "Text.Show.Text.Data.Semigroup" - [ testProperty "Min Int instance" (prop_matchesShow :: Int -> Min Int -> Bool) - , testProperty "Max Int instance" (prop_matchesShow :: Int -> Max Int -> Bool) - , testProperty "First Int instance" (prop_matchesShow :: Int -> First Int -> Bool) - , testProperty "Last Int Char" (prop_matchesShow :: Int -> Last Int -> Bool) - , testProperty "WrappedMonoid Int instance" (prop_matchesShow :: Int -> WrappedMonoid Int -> Bool) - , testProperty "Option Int instance" (prop_matchesShow :: Int -> Option Int -> Bool) - , testProperty "Arg Int Int instance" (prop_matchesShow :: Int -> Arg Int Int -> Bool) - ] - ]
− tests/Properties/Data/String/UTF8.hs
@@ -1,35 +0,0 @@-{-| -Module: Properties.Data.String.UTF8 -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for 'UTF8' strings. --} -module Properties.Data.String.UTF8 (utf8StringTests) where - -import qualified Data.ByteString as BS -import qualified Data.ByteString.Lazy as BL -import Data.String.UTF8 (UTF8) -import Data.Word (Word8) - -import Instances.Data.String.UTF8 () - -import Properties.Utils (prop_matchesShow) - -import Test.QuickCheck.Instances () -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.String.UTF8 () - -utf8StringTests :: [TestTree] -utf8StringTests = - [ testGroup "Text.Show.Text.Data.String.UTF8" - [ testProperty "UTF8 ByteString (strict) instance" (prop_matchesShow :: Int -> UTF8 BS.ByteString -> Bool) - , testProperty "UTF8 ByteString (lazy) instance" (prop_matchesShow :: Int -> UTF8 BL.ByteString -> Bool) - , testProperty "UTF8 [Word8] instance" (prop_matchesShow :: Int -> UTF8 [Word8] -> Bool) - ] - ]
− tests/Properties/Data/Tagged.hs
@@ -1,29 +0,0 @@-{-| -Module: Properties.Data.Tagged -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for 'Tagged' values. --} -module Properties.Data.Tagged (taggedTests) where - -import Data.Tagged (Tagged) - -import Instances.Data.Tagged () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.Tagged () - -taggedTests :: [TestTree] -taggedTests = - [ testGroup "Text.Show.Text.Data.Tagged" - [ testProperty "Tagged Char Int instance" (prop_matchesShow :: Int -> Tagged Char Int -> Bool) - ] - ]
− tests/Properties/Data/Time.hs
@@ -1,39 +0,0 @@-{-| -Module: Properties.Data.Time -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @time@ library. --} -module Properties.Data.Time (timeTests) where - -import Data.Time.Calendar (Day) -import Data.Time.Clock (DiffTime, UTCTime, NominalDiffTime) -import Data.Time.Clock.TAI (AbsoluteTime) -import Data.Time.LocalTime (TimeZone, TimeOfDay, LocalTime, ZonedTime) - -import Properties.Utils (prop_matchesShow) - -import Test.QuickCheck.Instances () -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.Time () - -timeTests :: [TestTree] -timeTests = - [ testGroup "Text.Show.Text.Data.Time" - [ testProperty "Day instance" (prop_matchesShow :: Int -> Day -> Bool) - , testProperty "DiffTime instance" (prop_matchesShow :: Int -> DiffTime -> Bool) - , testProperty "UTCTime instance" (prop_matchesShow :: Int -> UTCTime -> Bool) - , testProperty "NominalDiffTime instance" (prop_matchesShow :: Int -> NominalDiffTime -> Bool) - , testProperty "AbsoluteTime instance" (prop_matchesShow :: Int -> AbsoluteTime -> Bool) - , testProperty "TimeZone instance" (prop_matchesShow :: Int -> TimeZone -> Bool) - , testProperty "TimeOfDay instance" (prop_matchesShow :: Int -> TimeOfDay -> Bool) - , testProperty "LocalTime instance" (prop_matchesShow :: Int -> LocalTime -> Bool) - , testProperty "ZonedTime instance" (prop_matchesShow :: Int -> ZonedTime -> Bool) - ] - ]
− tests/Properties/Data/UnorderedContainers.hs
@@ -1,30 +0,0 @@-{-| -Module: Properties.Data.UnorderedContainers -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for 'HashMap's and 'HashSet's. --} -module Properties.Data.UnorderedContainers (unorderedContainersTests) where - -import Data.HashMap.Lazy (HashMap) -import Data.HashSet (HashSet) - -import Properties.Utils (prop_matchesShow) - -import Test.QuickCheck.Instances () -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Data.UnorderedContainers () - -unorderedContainersTests :: [TestTree] -unorderedContainersTests = - [ testGroup "Text.Show.Text.Data.UnorderedContainers" - [ testProperty "HashMap Char Char instance" (prop_matchesShow :: Int -> HashMap Char Char -> Bool) - , testProperty "HashSet Char instance" (prop_matchesShow :: Int -> HashSet Char -> Bool) - ] - ]
− tests/Properties/Language/Haskell/TH.hs
@@ -1,100 +0,0 @@-{-# LANGUAGE CPP #-} -{-| -Module: Properties.Language.Haskell.TH -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @template-haskell@ library. --} -module Properties.Language.Haskell.TH (templateHaskellTests) where - -import Instances.Language.Haskell.TH () - -import Language.Haskell.TH.PprLib -import Language.Haskell.TH.Syntax - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text (fromString) -import Text.Show.Text.Language.Haskell.TH (showbName') - --- | Verifies that `showName'` and `showbName'` have the same output. -prop_showName' :: NameIs -> Name -> Bool -prop_showName' nameIs name = fromString (showName' nameIs name) == showbName' nameIs name - -templateHaskellTests :: [TestTree] -templateHaskellTests = - [ testGroup "Text.Show.Text.Language.Haskell.TH" - [ -#if MIN_VERSION_template_haskell(2,9,0) - testProperty "AnnLookup instance" (prop_matchesShow :: Int -> AnnLookup -> Bool) - , testProperty "AnnTarget instance" (prop_matchesShow :: Int -> AnnTarget -> Bool), -#endif - testProperty "Body instance" (prop_matchesShow :: Int -> Body -> Bool) - , testProperty "Callconv instance" (prop_matchesShow :: Int -> Callconv -> Bool) -#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) - , testProperty "ClassInstance instance" (prop_matchesShow :: Int -> ClassInstance -> Bool) -#endif - , testProperty "Clause instance" (prop_matchesShow :: Int -> Clause -> Bool) - , testProperty "Con instance" (prop_matchesShow :: Int -> Con -> Bool) - , testProperty "Dec instance" (prop_matchesShow :: Int -> Dec -> Bool) - , testProperty "Exp instance" (prop_matchesShow :: Int -> Exp -> Bool) - , testProperty "FamFlavour instance" (prop_matchesShow :: Int -> FamFlavour -> Bool) - , testProperty "Fixity instance" (prop_matchesShow :: Int -> Fixity -> Bool) - , testProperty "FixityDirection instance" (prop_matchesShow :: Int -> FixityDirection -> Bool) - , testProperty "Foreign instance" (prop_matchesShow :: Int -> Foreign -> Bool) - , testProperty "FunDep instance" (prop_matchesShow :: Int -> FunDep -> Bool) - , testProperty "Guard instance" (prop_matchesShow :: Int -> Guard -> Bool) - , testProperty "Info instance" (prop_matchesShow :: Int -> Info -> Bool) -#if MIN_VERSION_template_haskell(2,8,0) - , testProperty "Inline instance" (prop_matchesShow :: Int -> Inline -> Bool) -#else - , testProperty "InlineSpec instance" (prop_matchesShow :: Int -> InlineSpec -> Bool) -#endif - , testProperty "Kind instance" (prop_matchesShow :: Int -> Kind -> Bool) - , testProperty "Lit instance" (prop_matchesShow :: Int -> Lit -> Bool) - , testProperty "Loc instance" (prop_matchesShow :: Int -> Loc -> Bool) - , testProperty "Match instance" (prop_matchesShow :: Int -> Match -> Bool) - , testProperty "ModName instance" (prop_matchesShow :: Int -> ModName -> Bool) -#if MIN_VERSION_template_haskell(2,9,0) - , testProperty "Module instance" (prop_matchesShow :: Int -> Module -> Bool) - , testProperty "ModuleInfo instance" (prop_matchesShow :: Int -> ModuleInfo -> Bool) -#endif - , testProperty "Name instance" (prop_matchesShow :: Int -> Name -> Bool) - , testProperty "showbName' output" prop_showName' - , testProperty "OccName instance" (prop_matchesShow :: Int -> OccName -> Bool) - , testProperty "Pat instance" (prop_matchesShow :: Int -> Pat -> Bool) -#if MIN_VERSION_template_haskell(2,8,0) - , testProperty "Phases instance" (prop_matchesShow :: Int -> Phases -> Bool) -#endif - , testProperty "PkgName instance" (prop_matchesShow :: Int -> PkgName -> Bool) - , testProperty "Pred instance" (prop_matchesShow :: Int -> Pred -> Bool) - , testProperty "Pragma instance" (prop_matchesShow :: Int -> Pragma -> Bool) - , testProperty "Range instance" (prop_matchesShow :: Int -> Range -> Bool) -#if MIN_VERSION_template_haskell(2,9,0) - , testProperty "Role instance" (prop_matchesShow :: Int -> Role -> Bool) -#endif -#if MIN_VERSION_template_haskell(2,8,0) - , testProperty "RuleBndr instance" (prop_matchesShow :: Int -> RuleBndr -> Bool) - , testProperty "RuleMatch instance" (prop_matchesShow :: Int -> RuleMatch -> Bool) -#endif - , testProperty "Safety instance" (prop_matchesShow :: Int -> Safety -> Bool) - , testProperty "Stmt instance" (prop_matchesShow :: Int -> Stmt -> Bool) - , testProperty "Strict instance" (prop_matchesShow :: Int -> Strict -> Bool) -#if MIN_VERSION_template_haskell(2,8,0) - , testProperty "TyLit instance" (prop_matchesShow :: Int -> TyLit -> Bool) -#endif - , testProperty "Type instance" (prop_matchesShow :: Int -> Type -> Bool) -#if MIN_VERSION_template_haskell(2,9,0) - , testProperty "TySynEqn instance" (prop_matchesShow :: Int -> TySynEqn -> Bool) -#endif - , testProperty "TyVarBndr instance" (prop_matchesShow :: Int -> TyVarBndr -> Bool) - , testProperty "Doc instance" (prop_matchesShow :: Int -> Doc -> Bool) - ] - ]
− tests/Properties/System/Console/Haskeline.hs
@@ -1,37 +0,0 @@-{-| -Module: Properties.System.Console.Haskeline -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @haskeline@ library. --} -module Properties.System.Console.Haskeline (haskelineTests) where - -import Instances.System.Console.Haskeline () - -import Properties.Utils (prop_matchesShow) - -import System.Console.Haskeline (Interrupt, defaultPrefs) -import System.Console.Haskeline.Completion (Completion) -import System.Console.Haskeline.History (History) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.HUnit ((@=?), testCase) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text (FromStringShow(..), showb) -import Text.Show.Text.System.Console.Haskeline () - -haskelineTests :: [TestTree] -haskelineTests = - [ testGroup "Text.Show.Text.System.Console.Haskeline" - [ testProperty "Interrupt instance" (prop_matchesShow :: Int -> Interrupt -> Bool) --- , testProperty "Prefs instance" (prop_matchesShow :: Int -> Prefs -> Bool) - , testCase "defaultPrefs Show output" $ showb (FromStringShow defaultPrefs) @=? showb defaultPrefs - , testProperty "Completion instance" (prop_matchesShow :: Int -> Completion -> Bool) - , testProperty "History instance" (prop_matchesShow :: Int -> History -> Bool) - ] - ]
− tests/Properties/System/Console/Terminfo.hs
@@ -1,30 +0,0 @@-{-| -Module: Properties.System.Console.Terminfo -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @terminfo@ library. --} -module Properties.System.Console.Terminfo (terminfoTests) where - -import Instances.System.Console.Terminfo () - -import Properties.Utils (prop_matchesShow) - -import System.Console.Terminfo.Color (Color) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.System.Console.Terminfo () - -terminfoTests :: [TestTree] -terminfoTests = - [ testGroup "Text.Show.Text.System.Console.Terminfo" - [ testProperty "Color instance" (prop_matchesShow :: Int -> Color -> Bool) --- , testProperty "SetupTermError instance" (prop_matchesShow :: Int -> SetupTermError -> Bool) - ] - ]
− tests/Properties/System/Directory.hs
@@ -1,35 +0,0 @@-{-# LANGUAGE CPP #-} -{-| -Module: Properties.System.Directory -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for 'Permissions'. --} -module Properties.System.Directory (directoryTests) where - -#if MIN_VERSION_directory(1,1,0) -import Instances.System.Directory () - -import Properties.Utils (prop_matchesShow) - -import System.Directory (Permissions) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.System.Directory () -#endif - -directoryTests :: [TestTree] -directoryTests = - [ -#if MIN_VERSION_directory(1,1,0) - testGroup "Text.Show.Text.System.Directory" - [ testProperty "Permissions instance" (prop_matchesShow :: Int -> Permissions -> Bool) - ] -#endif - ]
− tests/Properties/System/Locale.hs
@@ -1,29 +0,0 @@-{-| -Module: Properties.System.Locale -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for old 'TimeLocale's. --} -module Properties.System.Locale (oldLocaleTests) where - -import Instances.System.Locale () - -import Properties.Utils (prop_matchesShow) - -import System.Locale (TimeLocale) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.System.Locale () - -oldLocaleTests :: [TestTree] -oldLocaleTests = - [ testGroup "Text.Show.Text.System.Locale" - [ testProperty "TimeLocale instance" (prop_matchesShow :: Int -> TimeLocale -> Bool) - ] - ]
− tests/Properties/System/Posix.hs
@@ -1,35 +0,0 @@-{-| -Module: Properties.System.Posix -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @unix@ library. --} -module Properties.System.Posix (unixTests) where - -import Instances.System.Posix () - -import Properties.Utils (prop_matchesShow) - -import System.Posix.DynamicLinker (RTLDFlags, DL) -import System.Posix.Process (ProcessStatus) -import System.Posix.User (GroupEntry, UserEntry) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.System.Posix () - -unixTests :: [TestTree] -unixTests = - [ testGroup "Text.Show.Text.System.Posix" - [ testProperty "RTLDFlags instance" (prop_matchesShow :: Int -> RTLDFlags -> Bool) - , testProperty "DL instance" (prop_matchesShow :: Int -> DL -> Bool) - , testProperty "ProcessStatus instance" (prop_matchesShow :: Int -> ProcessStatus -> Bool) - , testProperty "GroupEntry instance" (prop_matchesShow :: Int -> GroupEntry -> Bool) - , testProperty "UserEntry instance" (prop_matchesShow :: Int -> UserEntry -> Bool) - ] - ]
− tests/Properties/System/Random.hs
@@ -1,29 +0,0 @@-{-| -Module: Properties.System.Random -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for 'StdGen' values. --} -module Properties.System.Random (randomTests) where - -import Instances.System.Random () - -import Properties.Utils (prop_matchesShow) - -import System.Random (StdGen) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.System.Random () - -randomTests :: [TestTree] -randomTests = - [ testGroup "Text.Show.Text.System.Random" - [ testProperty "StdGen instance" (prop_matchesShow :: Int -> StdGen -> Bool) - ] - ]
− tests/Properties/System/Time.hs
@@ -1,32 +0,0 @@-{-| -Module: Properties.System.Time -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in @old-time@. --} -module Properties.System.Time (oldTimeTests) where - -import Properties.Utils (prop_matchesShow) - -import System.Time (ClockTime, TimeDiff, CalendarTime, Month, Day) - -import Test.QuickCheck.Instances () -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.System.Time () - -oldTimeTests :: [TestTree] -oldTimeTests = - [ testGroup "Text.Show.Text.System.Time" - [ testProperty "ClockTime instance" (prop_matchesShow :: Int -> ClockTime -> Bool) - , testProperty "TimeDiff instance" (prop_matchesShow :: Int -> TimeDiff -> Bool) - , testProperty "CalendarTime instance" (prop_matchesShow :: Int -> CalendarTime -> Bool) - , testProperty "Month instance" (prop_matchesShow :: Int -> Month -> Bool) - , testProperty "Day instance" (prop_matchesShow :: Int -> Day -> Bool) - ] - ]
− tests/Properties/System/Win32.hs
@@ -1,41 +0,0 @@-{-| -Module: Properties.System.Win32 -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @Win32@ library. --} -module Properties.System.Win32 (win32Tests) where - -import Instances.System.Win32 () - -import Properties.Utils (prop_matchesShow) - -import System.Win32.DebugApi (DebugEventInfo, Exception) -import System.Win32.File (BY_HANDLE_FILE_INFORMATION, WIN32_FILE_ATTRIBUTE_DATA) -import System.Win32.Info (ProcessorArchitecture, SYSTEM_INFO) -import System.Win32.Time (FILETIME, SYSTEMTIME, TIME_ZONE_INFORMATION, TimeZoneId) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.System.Win32 () - -win32Tests :: [TestTree] -win32Tests = - [ testGroup "Text.Show.Text.System.Win32" - [ testProperty "DebugEventInfo instance" (prop_matchesShow :: Int -> DebugEventInfo -> Bool) - , testProperty "Exception instance" (prop_matchesShow :: Int -> Exception -> Bool) - , testProperty "BY_HANDLE_FILE_INFORMATION instance" (prop_matchesShow :: Int -> BY_HANDLE_FILE_INFORMATION -> Bool) - , testProperty "WIN32_FILE_ATTRIBUTE_DATA instance" (prop_matchesShow :: Int -> WIN32_FILE_ATTRIBUTE_DATA -> Bool) - , testProperty "ProcessorArchitecture instance" (prop_matchesShow :: Int -> ProcessorArchitecture -> Bool) - , testProperty "SYSTEM_INFO instance" (prop_matchesShow :: Int -> SYSTEM_INFO -> Bool) - , testProperty "FILETIME instance" (prop_matchesShow :: Int -> FILETIME -> Bool) - , testProperty "SYSTEMTIME instance" (prop_matchesShow :: Int -> SYSTEMTIME -> Bool) - , testProperty "TIME_ZONE_INFORMATION instance" (prop_matchesShow :: Int -> TIME_ZONE_INFORMATION -> Bool) - , testProperty "TimeZoneId instance" (prop_matchesShow :: Int -> TimeZoneId -> Bool) - ] - ]
− tests/Properties/Text/PrettyPrint.hs
@@ -1,45 +0,0 @@-{-# LANGUAGE CPP #-} -{-| -Module: Properties.Text.PrettyPrint -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @pretty@ library. --} -module Properties.Text.PrettyPrint (prettyTests) where - -import Instances.Text.PrettyPrint () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.PrettyPrint.HughesPJ (Doc, Mode, Style, TextDetails {-, renderStyle -}) -#if MIN_VERSION_pretty(1,1,2) -import Text.PrettyPrint.HughesPJClass (PrettyLevel) -#endif --- import Text.Show.Text (fromString) -import Text.Show.Text.Text.PrettyPrint () -- (renderStyleB) - --- | Verifies that the output of 'renderStyle' and 'renderStyleB' coincides. --- prop_renderStyle :: Style -> Doc -> Bool --- prop_renderStyle sty doc = fromString (renderStyle sty doc) == renderStyleB sty doc - -prettyTests :: [TestTree] -prettyTests = - [ testGroup "Text.Show.Text.Text.PrettyPrint" - [ testProperty "Doc instance" (prop_matchesShow :: Int -> Doc -> Bool) - -- TODO: Figure out why this randomly stalls forever --- , testProperty "renderStyleB output" prop_renderStyle - , testProperty "Mode instance" (prop_matchesShow :: Int -> Mode -> Bool) - , testProperty "Style instance" (prop_matchesShow :: Int -> Style -> Bool) - , testProperty "TextDetails instance" (prop_matchesShow :: Int -> TextDetails -> Bool) -#if MIN_VERSION_pretty(1,1,2) - , testProperty "PrettyLevel instance" (prop_matchesShow :: Int -> PrettyLevel -> Bool) -#endif - ] - ]
− tests/Properties/Text/XHtml.hs
@@ -1,33 +0,0 @@-{-| -Module: Properties.Text.XHtml -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @xhtml@ library. --} -module Properties.Text.XHtml (xhtmlTests) where - -import Instances.Text.XHtml () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Text.XHtml () -import Text.XHtml.Frameset (Html, HtmlAttr, HotLink) -import Text.XHtml.Table (HtmlTable) - -xhtmlTests :: [TestTree] -xhtmlTests = - [ testGroup "Text.Show.Text.Text.XHtml" - [ testProperty "Html instance" (prop_matchesShow :: Int -> Html -> Bool) - , testProperty "[Html] instance" (prop_matchesShow :: Int -> [Html] -> Bool) - , testProperty "HtmlAttr instance" (prop_matchesShow :: Int -> HtmlAttr -> Bool) - , testProperty "HotLink instance" (prop_matchesShow :: Int -> HotLink -> Bool) - , testProperty "HtmlTable instance" (prop_matchesShow :: Int -> HtmlTable -> Bool) - ] - ]
− tests/Properties/Trace/Hpc.hs
@@ -1,37 +0,0 @@-{-| -Module: Properties.Trace.Hpc -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ properties for data types in the @hpc@ library. --} -module Properties.Trace.Hpc (hpcTests) where - -import Instances.Trace.Hpc () - -import Properties.Utils (prop_matchesShow) - -import Test.Tasty (TestTree, testGroup) -import Test.Tasty.QuickCheck (testProperty) - -import Text.Show.Text.Trace.Hpc () - -import Trace.Hpc.Mix (Mix, BoxLabel, CondBox) -import Trace.Hpc.Tix (Tix, TixModule) -import Trace.Hpc.Util (HpcPos, Hash) - -hpcTests :: [TestTree] -hpcTests = - [ testGroup "Text.Show.Text.Trace.Hpc" - [ testProperty "Mix instance" (prop_matchesShow :: Int -> Mix -> Bool) - , testProperty "BoxLabel instance" (prop_matchesShow :: Int -> BoxLabel -> Bool) - , testProperty "CondBox instance" (prop_matchesShow :: Int -> CondBox -> Bool) - , testProperty "Tix instance" (prop_matchesShow :: Int -> Tix -> Bool) - , testProperty "TixModule instance" (prop_matchesShow :: Int -> TixModule -> Bool) - , testProperty "HpcPos instance" (prop_matchesShow :: Int -> HpcPos -> Bool) - , testProperty "Hash instance" (prop_matchesShow :: Int -> Hash -> Bool) - ] - ]
− tests/Properties/Utils.hs
@@ -1,24 +0,0 @@-{-| -Module: Properties.Utils -Copyright: (C) 2014-2015 Ryan Scott -License: BSD-style (see the file LICENSE) -Maintainer: Ryan Scott -Stability: Experimental -Portability: GHC - -@QuickCheck@ property-related utility functions. --} -module Properties.Utils (prop_matchesShow) where - -import Prelude hiding (Show) - -import Test.Tasty.QuickCheck (Arbitrary) - -import qualified Text.Show as S (Show) -import qualified Text.Show.Text as T (Show) -import Text.Show.Text (showbPrec, FromStringShow(..)) - --- | Verifies that a type's @Show@ instances coincide for both 'String's and 'Text', --- irrespective of precedence. -prop_matchesShow :: (S.Show a, T.Show a, Arbitrary a) => Int -> a -> Bool -prop_matchesShow p x = showbPrec p (FromStringShow x) == showbPrec p x
+ tests/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
+ tests/Spec/Compiler/HooplSpec.hs view
@@ -0,0 +1,40 @@+{-| +Module: Spec.Compiler.HooplSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @hoopl@ library. +-} +module Spec.Compiler.HooplSpec (main, spec) where + +import Compiler.Hoopl (Label, LabelMap, LabelSet, Pointed, + Unique, UniqueMap, UniqueSet, C) +import Compiler.Hoopl.Passes.Dominator (DominatorNode, DominatorTree, DPath) + +import Instances.Compiler.Hoopl () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Compiler.Hoopl () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Compiler.Hoopl" $ do + prop "Label instance" (prop_matchesShow :: Int -> Label -> Bool) + prop "LabelMap Char instance" (prop_matchesShow :: Int -> LabelMap Char -> Bool) + prop "LabelSet instance" (prop_matchesShow :: Int -> LabelSet -> Bool) + prop "Pointed C C Int instance" (prop_matchesShow :: Int -> Pointed C C Int -> Bool) + prop "Unique instance" (prop_matchesShow :: Int -> Unique -> Bool) + prop "UniqueMap Char instance" (prop_matchesShow :: Int -> UniqueMap Char -> Bool) + prop "UniqueSet instance" (prop_matchesShow :: Int -> UniqueSet -> Bool) + prop "DominatorNode instance" (prop_matchesShow :: Int -> DominatorNode -> Bool) + prop "DominatorTree instance" (prop_matchesShow :: Int -> DominatorTree -> Bool) + prop "DPath instance" (prop_matchesShow :: Int -> DPath -> Bool)
+ tests/Spec/Control/Applicative/TransSpec.hs view
@@ -0,0 +1,31 @@+{-| +Module: Spec.Control.Applicative.TransSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for applicative functor transformers. +-} +module Spec.Control.Applicative.TransSpec (main, spec) where + +import Control.Applicative.Backwards (Backwards) +import Control.Applicative.Lift (Lift) + +import Instances.Control.Applicative.Trans () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Control.Applicative.Trans () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Control.Applicative.Trans" $ do + prop "Backwards Maybe Int instance" (prop_matchesShow :: Int -> Backwards Maybe Int -> Bool) + prop "Lift Maybe Int instance" (prop_matchesShow :: Int -> Lift Maybe Int -> Bool)
+ tests/Spec/Control/Monad/TransSpec.hs view
@@ -0,0 +1,42 @@+{-# OPTIONS_GHC -fno-warn-warnings-deprecations #-} +{-| +Module: Spec.Control.Monad.TransSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for monad transformers. +-} +module Spec.Control.Monad.TransSpec (main, spec) where + +import Control.Monad.Trans.Error (ErrorT) +import Control.Monad.Trans.Except (ExceptT) +import Control.Monad.Trans.Identity (IdentityT) +import Control.Monad.Trans.List (ListT) +import Control.Monad.Trans.Maybe (MaybeT) +import qualified Control.Monad.Trans.Writer.Lazy as WL (WriterT) +import qualified Control.Monad.Trans.Writer.Strict as WS (WriterT) + +import Instances.Control.Monad.Trans () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Control.Monad.Trans () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Control.Monad.Trans" $ do + prop "ErrorT Char Maybe Int instance" (prop_matchesShow :: Int -> ErrorT Char Maybe Int -> Bool) + prop "ExceptT Char Maybe Int instance" (prop_matchesShow :: Int -> ExceptT Char Maybe Int -> Bool) + prop "IdentityT Maybe Int instance" (prop_matchesShow :: Int -> IdentityT Maybe Int -> Bool) + prop "ListT Maybe Char instance" (prop_matchesShow :: Int -> ListT Maybe Char -> Bool) + prop "Maybe [] Int instance" (prop_matchesShow :: Int -> MaybeT [] Int -> Bool) + prop "lazy WriterT String Maybe Int instance" (prop_matchesShow :: Int -> WL.WriterT String Maybe Int -> Bool) + prop "strict WriterT String Maybe Int instance" (prop_matchesShow :: Int -> WS.WriterT String Maybe Int -> Bool)
+ tests/Spec/Data/BinarySpec.hs view
@@ -0,0 +1,29 @@+{-| +Module: Spec.Data.BinarySpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for 'Decoder's. +-} +module Spec.Data.BinarySpec (main, spec) where + +import Data.Binary.Get.Internal (Decoder) + +import Instances.Data.Binary () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Data.Binary () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.Binary" $ + prop "Decoder Int instance" (prop_matchesShow :: Int -> Decoder Int -> Bool)
+ tests/Spec/Data/ContainersSpec.hs view
@@ -0,0 +1,42 @@+{-| +Module: Spec.Data.ContainersSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @containers@ library. +-} +module Spec.Data.ContainersSpec (main, spec) where + +import Data.IntMap (IntMap) +import Data.IntSet (IntSet) +import Data.Map (Map) +import Data.Sequence (Seq, ViewL, ViewR) +import Data.Set (Set) +import Data.Tree (Tree) + +import Instances.Data.Containers () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) +import Test.QuickCheck.Instances () + +import Text.Show.Text.Data.Containers () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.Containers" $ do + prop "IntMap Char instance" (prop_matchesShow :: Int -> IntMap Char -> Bool) + prop "IntSet instance" (prop_matchesShow :: Int -> IntSet -> Bool) + prop "Map Char Char instance" (prop_matchesShow :: Int -> Map Char Char -> Bool) + prop "Sequence Char" (prop_matchesShow :: Int -> Seq Char -> Bool) + prop "ViewL Int instance" (prop_matchesShow :: Int -> ViewL Int -> Bool) + prop "ViewR Int instance" (prop_matchesShow :: Int -> ViewR Int -> Bool) + prop "Set Char instance" (prop_matchesShow :: Int -> Set Char -> Bool) + prop "Tree Char instance" (prop_matchesShow :: Int -> Tree Char -> Bool)
+ tests/Spec/Data/Functor/TransSpec.hs view
@@ -0,0 +1,37 @@+{-| +Module: Spec.Data.Functor.TransSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for functor transformers. +-} +module Spec.Data.Functor.TransSpec (main, spec) where + +import Data.Functor.Compose (Compose) +import Data.Functor.Constant (Constant) +import Data.Functor.Product (Product) +import Data.Functor.Reverse (Reverse) +import Data.Functor.Sum (Sum) + +import Instances.Data.Functor.Trans () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Data.Functor.Trans () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.Functor.Trans" $ do + prop "Compose Maybe [] Char instance" (prop_matchesShow :: Int -> Compose Maybe [] Char -> Bool) + prop "Constant Int Char instance" (prop_matchesShow :: Int -> Constant Int Char -> Bool) + prop "Product Maybe [] Char instance" (prop_matchesShow :: Int -> Product Maybe [] Char -> Bool) + prop "Reverse Maybe Int instance" (prop_matchesShow :: Int -> Reverse Maybe Int -> Bool) + prop "Sum Maybe [] Char instance" (prop_matchesShow :: Int -> Sum Maybe [] Char -> Bool)
+ tests/Spec/Data/List/NonEmptySpec.hs view
@@ -0,0 +1,29 @@+{-| +Module: Spec.Data.List.NonEmptySpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for 'NonEmpty' lists. +-} +module Spec.Data.List.NonEmptySpec (main, spec) where + +import Data.List.NonEmpty (NonEmpty) + +import Instances.Data.List.NonEmpty () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Data.List.NonEmpty () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.List.NonEmpty" $ + prop "NonEmpty Char instance" (prop_matchesShow :: Int -> NonEmpty Char -> Bool)
+ tests/Spec/Data/SemigroupSpec.hs view
@@ -0,0 +1,35 @@+{-| +Module: Spec.Data.SemigroupSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for @Semigroup@ data types. +-} +module Spec.Data.SemigroupSpec (main, spec) where + +import Data.Semigroup (Min, Max, First, Last, WrappedMonoid, Option, Arg) + +import Instances.Data.Semigroup () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Data.Semigroup () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.Semigroup" $ do + prop "Min Int instance" (prop_matchesShow :: Int -> Min Int -> Bool) + prop "Max Int instance" (prop_matchesShow :: Int -> Max Int -> Bool) + prop "First Int instance" (prop_matchesShow :: Int -> First Int -> Bool) + prop "Last Int Char" (prop_matchesShow :: Int -> Last Int -> Bool) + prop "WrappedMonoid Int instance" (prop_matchesShow :: Int -> WrappedMonoid Int -> Bool) + prop "Option Int instance" (prop_matchesShow :: Int -> Option Int -> Bool) + prop "Arg Int Int instance" (prop_matchesShow :: Int -> Arg Int Int -> Bool)
+ tests/Spec/Data/String/UTF8Spec.hs view
@@ -0,0 +1,35 @@+{-| +Module: Spec.Data.String.UTF8Spec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for 'UTF8' strings. +-} +module Spec.Data.String.UTF8Spec (main, spec) where + +import qualified Data.ByteString as BS +import qualified Data.ByteString.Lazy as BL +import Data.String.UTF8 (UTF8) +import Data.Word (Word8) + +import Instances.Data.String.UTF8 () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) +import Test.QuickCheck.Instances () + +import Text.Show.Text.Data.String.UTF8 () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.String.UTF8" $ do + prop "UTF8 ByteString (strict) instance" (prop_matchesShow :: Int -> UTF8 BS.ByteString -> Bool) + prop "UTF8 ByteString (lazy) instance" (prop_matchesShow :: Int -> UTF8 BL.ByteString -> Bool) + prop "UTF8 [Word8] instance" (prop_matchesShow :: Int -> UTF8 [Word8] -> Bool)
+ tests/Spec/Data/TaggedSpec.hs view
@@ -0,0 +1,29 @@+{-| +Module: Spec.Data.TaggedSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for 'Tagged' values. +-} +module Spec.Data.TaggedSpec (main, spec) where + +import Data.Tagged (Tagged) + +import Instances.Data.Tagged () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Data.Tagged () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.Tagged" $ + prop "Tagged Char Int instance" (prop_matchesShow :: Int -> Tagged Char Int -> Bool)
+ tests/Spec/Data/TimeSpec.hs view
@@ -0,0 +1,39 @@+{-| +Module: Spec.Data.TimeSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @time@ library. +-} +module Spec.Data.TimeSpec (main, spec) where + +import Data.Time.Calendar (Day) +import Data.Time.Clock (DiffTime, UTCTime, NominalDiffTime) +import Data.Time.Clock.TAI (AbsoluteTime) +import Data.Time.LocalTime (TimeZone, TimeOfDay, LocalTime, ZonedTime) + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) +import Test.QuickCheck.Instances () + +import Text.Show.Text.Data.Time () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.Time" $ do + prop "Day instance" (prop_matchesShow :: Int -> Day -> Bool) + prop "DiffTime instance" (prop_matchesShow :: Int -> DiffTime -> Bool) + prop "UTCTime instance" (prop_matchesShow :: Int -> UTCTime -> Bool) + prop "NominalDiffTime instance" (prop_matchesShow :: Int -> NominalDiffTime -> Bool) + prop "AbsoluteTime instance" (prop_matchesShow :: Int -> AbsoluteTime -> Bool) + prop "TimeZone instance" (prop_matchesShow :: Int -> TimeZone -> Bool) + prop "TimeOfDay instance" (prop_matchesShow :: Int -> TimeOfDay -> Bool) + prop "LocalTime instance" (prop_matchesShow :: Int -> LocalTime -> Bool) + prop "ZonedTime instance" (prop_matchesShow :: Int -> ZonedTime -> Bool)
+ tests/Spec/Data/UnorderedContainersSpec.hs view
@@ -0,0 +1,30 @@+{-| +Module: Spec.Data.UnorderedContainersSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for 'HashMap's and 'HashSet's. +-} +module Spec.Data.UnorderedContainersSpec (main, spec) where + +import Data.HashMap.Lazy (HashMap) +import Data.HashSet (HashSet) + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) +import Test.QuickCheck.Instances () + +import Text.Show.Text.Data.UnorderedContainers () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Data.UnorderedContainers" $ do + prop "HashMap Char Char instance" (prop_matchesShow :: Int -> HashMap Char Char -> Bool) + prop "HashSet Char instance" (prop_matchesShow :: Int -> HashSet Char -> Bool)
+ tests/Spec/Language/Haskell/THSpec.hs view
@@ -0,0 +1,99 @@+{-# LANGUAGE CPP #-} +{-| +Module: Spec.Language.Haskell.THSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@QuickCheck@ properties for data types in the @template-haskell@ library. +-} +module Spec.Language.Haskell.THSpec (main, spec) where + +import Instances.Language.Haskell.TH () + +import Language.Haskell.TH.PprLib +import Language.Haskell.TH.Syntax + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text (fromString) +import Text.Show.Text.Language.Haskell.TH (showbName') + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Language.Haskell.TH" $ do +#if MIN_VERSION_template_haskell(2,9,0) + prop "AnnLookup instance" (prop_matchesShow :: Int -> AnnLookup -> Bool) + prop "AnnTarget instance" (prop_matchesShow :: Int -> AnnTarget -> Bool) +#endif + prop "Body instance" (prop_matchesShow :: Int -> Body -> Bool) + prop "Callconv instance" (prop_matchesShow :: Int -> Callconv -> Bool) +#if MIN_VERSION_template_haskell(2,5,0) && !(MIN_VERSION_template_haskell(2,7,0)) + prop "ClassInstance instance" (prop_matchesShow :: Int -> ClassInstance -> Bool) +#endif + prop "Clause instance" (prop_matchesShow :: Int -> Clause -> Bool) + prop "Con instance" (prop_matchesShow :: Int -> Con -> Bool) + prop "Dec instance" (prop_matchesShow :: Int -> Dec -> Bool) + prop "Exp instance" (prop_matchesShow :: Int -> Exp -> Bool) + prop "FamFlavour instance" (prop_matchesShow :: Int -> FamFlavour -> Bool) + prop "Fixity instance" (prop_matchesShow :: Int -> Fixity -> Bool) + prop "FixityDirection instance" (prop_matchesShow :: Int -> FixityDirection -> Bool) + prop "Foreign instance" (prop_matchesShow :: Int -> Foreign -> Bool) + prop "FunDep instance" (prop_matchesShow :: Int -> FunDep -> Bool) + prop "Guard instance" (prop_matchesShow :: Int -> Guard -> Bool) + prop "Info instance" (prop_matchesShow :: Int -> Info -> Bool) +#if MIN_VERSION_template_haskell(2,8,0) + prop "Inline instance" (prop_matchesShow :: Int -> Inline -> Bool) +#else + prop "InlineSpec instance" (prop_matchesShow :: Int -> InlineSpec -> Bool) +#endif + prop "Kind instance" (prop_matchesShow :: Int -> Kind -> Bool) + prop "Lit instance" (prop_matchesShow :: Int -> Lit -> Bool) + prop "Loc instance" (prop_matchesShow :: Int -> Loc -> Bool) + prop "Match instance" (prop_matchesShow :: Int -> Match -> Bool) + prop "ModName instance" (prop_matchesShow :: Int -> ModName -> Bool) +#if MIN_VERSION_template_haskell(2,9,0) + prop "Module instance" (prop_matchesShow :: Int -> Module -> Bool) + prop "ModuleInfo instance" (prop_matchesShow :: Int -> ModuleInfo -> Bool) +#endif + prop "Name instance" (prop_matchesShow :: Int -> Name -> Bool) + prop "showbName' output" prop_showName' + prop "OccName instance" (prop_matchesShow :: Int -> OccName -> Bool) + prop "Pat instance" (prop_matchesShow :: Int -> Pat -> Bool) +#if MIN_VERSION_template_haskell(2,8,0) + prop "Phases instance" (prop_matchesShow :: Int -> Phases -> Bool) +#endif + prop "PkgName instance" (prop_matchesShow :: Int -> PkgName -> Bool) + prop "Pred instance" (prop_matchesShow :: Int -> Pred -> Bool) + prop "Pragma instance" (prop_matchesShow :: Int -> Pragma -> Bool) + prop "Range instance" (prop_matchesShow :: Int -> Range -> Bool) +#if MIN_VERSION_template_haskell(2,9,0) + prop "Role instance" (prop_matchesShow :: Int -> Role -> Bool) +#endif +#if MIN_VERSION_template_haskell(2,8,0) + prop "RuleBndr instance" (prop_matchesShow :: Int -> RuleBndr -> Bool) + prop "RuleMatch instance" (prop_matchesShow :: Int -> RuleMatch -> Bool) +#endif + prop "Safety instance" (prop_matchesShow :: Int -> Safety -> Bool) + prop "Stmt instance" (prop_matchesShow :: Int -> Stmt -> Bool) + prop "Strict instance" (prop_matchesShow :: Int -> Strict -> Bool) +#if MIN_VERSION_template_haskell(2,8,0) + prop "TyLit instance" (prop_matchesShow :: Int -> TyLit -> Bool) +#endif + prop "Type instance" (prop_matchesShow :: Int -> Type -> Bool) +#if MIN_VERSION_template_haskell(2,9,0) + prop "TySynEqn instance" (prop_matchesShow :: Int -> TySynEqn -> Bool) +#endif + prop "TyVarBndr instance" (prop_matchesShow :: Int -> TyVarBndr -> Bool) + prop "Doc instance" (prop_matchesShow :: Int -> Doc -> Bool) + +-- | Verifies that `showName'` and `showbName'` have the same output. +prop_showName' :: NameIs -> Name -> Bool +prop_showName' nameIs name = fromString (showName' nameIs name) == showbName' nameIs name
+ tests/Spec/System/Console/HaskelineSpec.hs view
@@ -0,0 +1,36 @@+{-| +Module: Spec.System.Console.HaskelineSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @haskeline@ library. +-} +module Spec.System.Console.HaskelineSpec (main, spec) where + +import Instances.System.Console.Haskeline () + +import Spec.Utils (prop_matchesShow) + +import System.Console.Haskeline (Interrupt, defaultPrefs) +import System.Console.Haskeline.Completion (Completion) +import System.Console.Haskeline.History (History) + +import Test.Hspec (Spec, describe, hspec, it, parallel, shouldBe) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text (FromStringShow(..), showb) +import Text.Show.Text.System.Console.Haskeline () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.System.Console.Haskeline" $ do + prop "Interrupt instance" (prop_matchesShow :: Int -> Interrupt -> Bool) +-- prop "Prefs instance" (prop_matchesShow :: Int -> Prefs -> Bool) + it "defaultPrefs Show output" $ showb (FromStringShow defaultPrefs) `shouldBe` showb defaultPrefs + prop "Completion instance" (prop_matchesShow :: Int -> Completion -> Bool) + prop "History instance" (prop_matchesShow :: Int -> History -> Bool)
+ tests/Spec/System/Console/TerminfoSpec.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE CPP #-} +{-| +Module: Spec.System.Console.TerminfoSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @terminfo@ library. +-} +module Spec.System.Console.TerminfoSpec (main, spec) where + +import Prelude () +import Prelude.Compat + +import Test.Hspec (Spec, hspec, parallel) + +#if !defined(mingw32_HOST_OS) +import Instances.System.Console.Terminfo () + +import Spec.Utils (prop_matchesShow) + +import System.Console.Terminfo.Color (Color) + +import Test.Hspec (describe) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.System.Console.Terminfo () +#endif + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel $ +#if !defined(mingw32_HOST_OS) + describe "Text.Show.Text.System.Console.Terminfo" $ do + prop "Color instance" (prop_matchesShow :: Int -> Color -> Bool) +-- prop "SetupTermError instance" (prop_matchesShow :: Int -> SetupTermError -> Bool) +#else + pure () +#endif
+ tests/Spec/System/DirectorySpec.hs view
@@ -0,0 +1,42 @@+{-# LANGUAGE CPP #-} +{-| +Module: Spec.System.DirectorySpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for 'Permissions'. +-} +module Spec.System.DirectorySpec (main, spec) where + +import Prelude () +import Prelude.Compat + +import Test.Hspec (Spec, hspec, parallel) + +#if MIN_VERSION_directory(1,1,0) +import Instances.System.Directory () + +import Spec.Utils (prop_matchesShow) + +import System.Directory (Permissions) + +import Test.Hspec (describe) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.System.Directory () +#endif + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel $ +#if MIN_VERSION_directory(1,1,0) + describe "Text.Show.Text.System.Directory" $ + prop "Permissions instance" (prop_matchesShow :: Int -> Permissions -> Bool) +#else + pure () +#endif
+ tests/Spec/System/LocaleSpec.hs view
@@ -0,0 +1,29 @@+{-| +Module: Spec.System.LocaleSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for old 'TimeLocale's. +-} +module Spec.System.LocaleSpec (main, spec) where + +import Instances.System.Locale () + +import Spec.Utils (prop_matchesShow) + +import System.Locale (TimeLocale) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.System.Locale () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.System.Locale" $ + prop "TimeLocale instance" (prop_matchesShow :: Int -> TimeLocale -> Bool)
+ tests/Spec/System/PosixSpec.hs view
@@ -0,0 +1,48 @@+{-# LANGUAGE CPP #-} +{-| +Module: Spec.System.PosixSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @unix@ library. +-} +module Spec.System.PosixSpec (main, spec) where + +import Prelude () +import Prelude.Compat + +import Test.Hspec (Spec, hspec, parallel) + +#if !defined(mingw32_HOST_OS) +import Instances.System.Posix () + +import Spec.Utils (prop_matchesShow) + +import System.Posix.DynamicLinker (RTLDFlags, DL) +import System.Posix.Process (ProcessStatus) +import System.Posix.User (GroupEntry, UserEntry) + +import Test.Hspec (describe) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.System.Posix () +#endif + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel $ +#if !defined(mingw32_HOST_OS) + describe "Text.Show.Text.System.Posix" $ do + prop "RTLDFlags instance" (prop_matchesShow :: Int -> RTLDFlags -> Bool) + prop "DL instance" (prop_matchesShow :: Int -> DL -> Bool) + prop "ProcessStatus instance" (prop_matchesShow :: Int -> ProcessStatus -> Bool) + prop "GroupEntry instance" (prop_matchesShow :: Int -> GroupEntry -> Bool) + prop "UserEntry instance" (prop_matchesShow :: Int -> UserEntry -> Bool) +#else + pure () +#endif
+ tests/Spec/System/RandomSpec.hs view
@@ -0,0 +1,29 @@+{-| +Module: Spec.System.RandomSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for 'StdGen' values. +-} +module Spec.System.RandomSpec (main, spec) where + +import Instances.System.Random () + +import Spec.Utils (prop_matchesShow) + +import System.Random (StdGen) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.System.Random () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.System.Random" $ + prop "StdGen instance" (prop_matchesShow :: Int -> StdGen -> Bool)
+ tests/Spec/System/TimeSpec.hs view
@@ -0,0 +1,32 @@+{-| +Module: Spec.System.TimeSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@QuickCheck@ properties for data types in @old-time@. +-} +module Spec.System.TimeSpec (main, spec) where + +import Spec.Utils (prop_matchesShow) + +import System.Time (ClockTime, TimeDiff, CalendarTime, Month, Day) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) +import Test.QuickCheck.Instances () + +import Text.Show.Text.System.Time () + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.System.Time" $ do + prop "ClockTime instance" (prop_matchesShow :: Int -> ClockTime -> Bool) + prop "TimeDiff instance" (prop_matchesShow :: Int -> TimeDiff -> Bool) + prop "CalendarTime instance" (prop_matchesShow :: Int -> CalendarTime -> Bool) + prop "Month instance" (prop_matchesShow :: Int -> Month -> Bool) + prop "Day instance" (prop_matchesShow :: Int -> Day -> Bool)
+ tests/Spec/System/Win32Spec.hs view
@@ -0,0 +1,54 @@+{-# LANGUAGE CPP #-} +{-| +Module: Spec.System.Win32Spec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @Win32@ library. +-} +module Spec.System.Win32Spec (main, spec) where + +import Prelude () +import Prelude.Compat + +import Test.Hspec (Spec, hspec, parallel) + +#if defined(mingw32_HOST_OS) +import Instances.System.Win32 () + +import Spec.Utils (prop_matchesShow) + +import System.Win32.DebugApi (DebugEventInfo, Exception) +import System.Win32.File (BY_HANDLE_FILE_INFORMATION, WIN32_FILE_ATTRIBUTE_DATA) +import System.Win32.Info (ProcessorArchitecture, SYSTEM_INFO) +import System.Win32.Time (FILETIME, SYSTEMTIME, TIME_ZONE_INFORMATION, TimeZoneId) + +import Test.Hspec (describe) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.System.Win32 () +#endif + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel $ +#if defined(mingw32_HOST_OS) + describe "Text.Show.Text.System.Win32" $ do + prop "DebugEventInfo instance" (prop_matchesShow :: Int -> DebugEventInfo -> Bool) + prop "Exception instance" (prop_matchesShow :: Int -> Exception -> Bool) + prop "BY_HANDLE_FILE_INFORMATION instance" (prop_matchesShow :: Int -> BY_HANDLE_FILE_INFORMATION -> Bool) + prop "WIN32_FILE_ATTRIBUTE_DATA instance" (prop_matchesShow :: Int -> WIN32_FILE_ATTRIBUTE_DATA -> Bool) + prop "ProcessorArchitecture instance" (prop_matchesShow :: Int -> ProcessorArchitecture -> Bool) + prop "SYSTEM_INFO instance" (prop_matchesShow :: Int -> SYSTEM_INFO -> Bool) + prop "FILETIME instance" (prop_matchesShow :: Int -> FILETIME -> Bool) + prop "SYSTEMTIME instance" (prop_matchesShow :: Int -> SYSTEMTIME -> Bool) + prop "TIME_ZONE_INFORMATION instance" (prop_matchesShow :: Int -> TIME_ZONE_INFORMATION -> Bool) + prop "TimeZoneId instance" (prop_matchesShow :: Int -> TimeZoneId -> Bool) +#else + pure () +#endif
+ tests/Spec/Text/PrettyPrintSpec.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE CPP #-} +{-| +Module: Spec.Text.PrettyPrintSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @pretty@ library. +-} +module Spec.Text.PrettyPrintSpec (main, spec) where + +import Instances.Text.PrettyPrint () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.PrettyPrint.HughesPJ (Doc, Mode, Style, TextDetails {-, renderStyle -}) +#if MIN_VERSION_pretty(1,1,2) +import Text.PrettyPrint.HughesPJClass (PrettyLevel) +#endif +-- import Text.Show.Text (fromString) +import Text.Show.Text.Text.PrettyPrint () -- (renderStyleB) + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Text.PrettyPrint" $ do + prop "Doc instance" (prop_matchesShow :: Int -> Doc -> Bool) + -- TODO: Figure out why this randomly stalls forever +-- prop "renderStyleB output" prop_renderStyle + prop "Mode instance" (prop_matchesShow :: Int -> Mode -> Bool) + prop "Style instance" (prop_matchesShow :: Int -> Style -> Bool) + prop "TextDetails instance" (prop_matchesShow :: Int -> TextDetails -> Bool) +#if MIN_VERSION_pretty(1,1,2) + prop "PrettyLevel instance" (prop_matchesShow :: Int -> PrettyLevel -> Bool) +#endif + +-- | Verifies that the output of 'renderStyle' and 'renderStyleB' coincides. +-- prop_renderStyle :: Style -> Doc -> Bool +-- prop_renderStyle sty doc = fromString (renderStyle sty doc) == renderStyleB sty doc
+ tests/Spec/Text/XHtmlSpec.hs view
@@ -0,0 +1,33 @@+{-| +Module: Spec.Text.XHtmlSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @xhtml@ library. +-} +module Spec.Text.XHtmlSpec (main, spec) where + +import Instances.Text.XHtml () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Text.XHtml () +import Text.XHtml.Frameset (Html, HtmlAttr, HotLink) +import Text.XHtml.Table (HtmlTable) + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Text.XHtml" $ do + prop "Html instance" (prop_matchesShow :: Int -> Html -> Bool) + prop "[Html] instance" (prop_matchesShow :: Int -> [Html] -> Bool) + prop "HtmlAttr instance" (prop_matchesShow :: Int -> HtmlAttr -> Bool) + prop "HotLink instance" (prop_matchesShow :: Int -> HotLink -> Bool) + prop "HtmlTable instance" (prop_matchesShow :: Int -> HtmlTable -> Bool)
+ tests/Spec/Trace/HpcSpec.hs view
@@ -0,0 +1,37 @@+{-| +Module: Spec.Trace.HpcSpec +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@hspec@ tests for data types in the @hpc@ library. +-} +module Spec.Trace.HpcSpec (main, spec) where + +import Instances.Trace.Hpc () + +import Spec.Utils (prop_matchesShow) + +import Test.Hspec (Spec, describe, hspec, parallel) +import Test.Hspec.QuickCheck (prop) + +import Text.Show.Text.Trace.Hpc () + +import Trace.Hpc.Mix (Mix, BoxLabel, CondBox) +import Trace.Hpc.Tix (Tix, TixModule) +import Trace.Hpc.Util (HpcPos, Hash) + +main :: IO () +main = hspec spec + +spec :: Spec +spec = parallel . describe "Text.Show.Text.Trace.Hpc" $ do + prop "Mix instance" (prop_matchesShow :: Int -> Mix -> Bool) + prop "BoxLabel instance" (prop_matchesShow :: Int -> BoxLabel -> Bool) + prop "CondBox instance" (prop_matchesShow :: Int -> CondBox -> Bool) + prop "Tix instance" (prop_matchesShow :: Int -> Tix -> Bool) + prop "TixModule instance" (prop_matchesShow :: Int -> TixModule -> Bool) + prop "HpcPos instance" (prop_matchesShow :: Int -> HpcPos -> Bool) + prop "Hash instance" (prop_matchesShow :: Int -> Hash -> Bool)
+ tests/Spec/Utils.hs view
@@ -0,0 +1,22 @@+{-| +Module: Spec.Utils +Copyright: (C) 2014-2015 Ryan Scott +License: BSD-style (see the file LICENSE) +Maintainer: Ryan Scott +Stability: Experimental +Portability: GHC + +@QuickCheck@ property-related utility functions. +-} +module Spec.Utils (prop_matchesShow) where + +import Prelude hiding (Show) + +import qualified Text.Show as S (Show) +import qualified Text.Show.Text as T (Show) +import Text.Show.Text (showbPrec, FromStringShow(..)) + +-- | Verifies that a type's @Show@ instances coincide for both 'String's and 'Text', +-- irrespective of precedence. +prop_matchesShow :: (S.Show a, T.Show a) => Int -> a -> Bool +prop_matchesShow p x = showbPrec p (FromStringShow x) == showbPrec p x
text-show-instances.cabal view
@@ -1,5 +1,5 @@ name: text-show-instances -version: 0.3.0.1 +version: 0.4 synopsis: Additional instances for text-show description: @text-show-instances@ is a supplemental library to @text-show@ that provides additional @Show@ instances for data types in @@ -65,12 +65,13 @@ copyright: (C) 2014-2015 Ryan Scott category: Text build-type: Simple +tested-with: GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.1 extra-source-files: CHANGELOG.md, README.md, include/inline.h cabal-version: >=1.10 source-repository head type: git - location: git://github.com/RyanGlScott/text-show-instances.git + location: https://github.com/RyanGlScott/text-show-instances library exposed-modules: Text.Show.Text.Instances @@ -97,15 +98,16 @@ Text.Show.Text.Text.PrettyPrint Text.Show.Text.Text.XHtml Text.Show.Text.Trace.Hpc - other-modules: Text.Show.Text.Compiler - Text.Show.Text.Control - Text.Show.Text.Data - Text.Show.Text.Language - Text.Show.Text.System - Text.Show.Text.Text - Text.Show.Text.Trace - Text.Show.Text.Utils - build-depends: base >= 4.2 && < 5 + + -- Only exports functions if using Windows + Text.Show.Text.System.Win32 + + -- Only exports functions if not using Windows + Text.Show.Text.System.Console.Terminfo + Text.Show.Text.System.Posix + other-modules: Text.Show.Text.Utils + build-depends: base >= 4.3 && < 5 + , base-compat >= 0.8.1 && < 1 , binary >= 0.6 && < 0.8 , bytestring >= 0.9 && < 0.11 , containers >= 0.1 && < 0.6 @@ -119,9 +121,9 @@ , random >= 1.0.1 && < 1.2 , semigroups >= 0.16.2 && < 1 , tagged >= 0.4.4 && < 1 - , template-haskell >= 2.4 && < 2.11 - , text >= 0.8 && < 1.3 - , text-show >= 0.5 && < 0.8 + , template-haskell >= 2.5 && < 2.11 + , text >= 0.11.1 && < 1.3 + , text-show >= 0.5 && < 0.9 , time >= 0.1 && < 1.6 , transformers >= 0.2.1 && < 0.5 , transformers-compat >= 0.3 && < 1 @@ -138,16 +140,13 @@ if os(windows) build-depends: Win32 >= 2.1 && < 2.4 - exposed-modules: Text.Show.Text.System.Win32 else build-depends: terminfo >= 0.3.2 && < 0.5 , unix >= 2 && < 2.8 - exposed-modules: Text.Show.Text.System.Console.Terminfo - Text.Show.Text.System.Posix -test-suite text-show-instances-properties +test-suite text-show-instances-spec type: exitcode-stdio-1.0 - main-is: Properties.hs + main-is: Spec.hs other-modules: Instances.Compiler.Hoopl Instances.Control.Applicative.Trans Instances.Control.Monad.Trans @@ -168,29 +167,45 @@ Instances.Text.XHtml Instances.Trace.Hpc Instances.Utils - Properties.Compiler.Hoopl - Properties.Control.Applicative.Trans - Properties.Control.Monad.Trans - Properties.Data.Binary - Properties.Data.Containers - Properties.Data.Functor.Trans - Properties.Data.List.NonEmpty - Properties.Data.Semigroup - Properties.Data.String.UTF8 - Properties.Data.Tagged - Properties.Data.Time - Properties.Data.UnorderedContainers - Properties.Language.Haskell.TH - Properties.System.Console.Haskeline - Properties.System.Directory - Properties.System.Locale - Properties.System.Random - Properties.System.Time - Properties.Text.PrettyPrint - Properties.Text.XHtml - Properties.Trace.Hpc - Properties.Utils - build-depends: base >= 4.5 && < 5 + + -- Only exports functions if using Windows + Instances.System.Win32 + + -- Only exports functions if not using Windows + Instances.System.Console.Terminfo + Instances.System.Posix + + Spec.Compiler.HooplSpec + Spec.Control.Applicative.TransSpec + Spec.Control.Monad.TransSpec + Spec.Data.BinarySpec + Spec.Data.ContainersSpec + Spec.Data.Functor.TransSpec + Spec.Data.List.NonEmptySpec + Spec.Data.SemigroupSpec + Spec.Data.String.UTF8Spec + Spec.Data.TaggedSpec + Spec.Data.TimeSpec + Spec.Data.UnorderedContainersSpec + Spec.Language.Haskell.THSpec + Spec.System.Console.HaskelineSpec + Spec.System.DirectorySpec + Spec.System.LocaleSpec + Spec.System.RandomSpec + Spec.System.TimeSpec + Spec.Text.PrettyPrintSpec + Spec.Text.XHtmlSpec + Spec.Trace.HpcSpec + Spec.Utils + + -- Only exports functions if using Windows + Spec.System.Win32Spec + + -- Only exports functions if not using Windows + Spec.System.Console.TerminfoSpec + Spec.System.PosixSpec + build-depends: base >= 4.3 && < 5 + , base-compat >= 0.8.1 && < 1 , binary >= 0.6 && < 0.8 , bytestring >= 0.9 && < 0.11 , containers >= 0.1 && < 0.6 @@ -198,19 +213,18 @@ , haskeline >= 0.7 && < 0.8 , hoopl >= 3.8.7 && < 3.11 , hpc >= 0.5 && < 0.7 + , hspec >= 2 && < 3 , old-locale >= 1 && < 1.1 , old-time >= 1 && < 1.2 , pretty >= 1 && < 1.2 + , QuickCheck >= 2.5 && < 3 , quickcheck-instances >= 0.1 && < 0.4 , random >= 1.0.1 && < 1.2 , semigroups >= 0.8.4 && < 1 , tagged >= 0.4.4 && < 1 - , tasty >= 0.8 && < 0.11 - , tasty-hunit >= 0.8 && < 0.10 - , tasty-quickcheck >= 0.8 && < 0.9 - , template-haskell >= 2.4 && < 2.11 - , text-show >= 0.5 && < 0.8 - , text-show-instances == 0.3.0.1 + , template-haskell >= 2.5 && < 2.11 + , text-show >= 0.5 && < 0.9 + , text-show-instances == 0.4 , time >= 0.1 && < 1.6 , transformers >= 0.2.1 && < 0.5 , transformers-compat >= 0.3 && < 1 @@ -220,16 +234,10 @@ , xhtml >= 3000.2 && < 3000.3 hs-source-dirs: tests default-language: Haskell2010 - ghc-options: -Wall + ghc-options: -Wall -threaded -rtsopts if os(windows) build-depends: Win32 >= 2.1 && < 2.4 - other-modules: Instances.System.Win32 - Properties.System.Win32 else build-depends: terminfo >= 0.3.2 && < 0.5 , unix >= 2 && < 2.8 - other-modules: Instances.System.Console.Terminfo - Instances.System.Posix - Properties.System.Console.Terminfo - Properties.System.Posix