prednote 0.32.0.0 → 0.32.0.4
raw patch · 10 files changed
+208/−140 lines, 10 filesdep +bytestringdep +tastydep +tasty-quickcheckdep −quickpulldep ~QuickCheckdep ~rainbowPVP ok
version bump matches the API change (PVP)
Dependencies added: bytestring, tasty, tasty-quickcheck, tasty-th
Dependencies removed: quickpull
Dependency ranges changed: QuickCheck, rainbow
API changes (from Hackage documentation)
Files
- genCabal.hs +19/−7
- lib/Prednote/Comparisons.hs +3/−4
- lib/Prednote/Core.hs +7/−6
- prednote.cabal +22/−13
- tests/Decrees.hs +0/−26
- tests/Prednote/Core/Instances.hs +1/−1
- tests/Prednote/Core/Properties.hs +7/−0
- tests/Rainbow/Instances.hs +144/−0
- tests/Rainbow/Types/Instances.hs +0/−80
- tests/prednote-tests.hs +5/−3
genCabal.hs view
@@ -8,13 +8,13 @@ import Control.Applicative versionInts :: [Word]-versionInts = [0,32,0,0]+versionInts = [0,32,0,4] base :: Package base = closedOpen "base" [4,5,0,0] [5] rainbow :: Package-rainbow = closedOpen "rainbow" [0,20,0,4] [0,21]+rainbow = nextBreaking "rainbow" [0,22] text :: Package text = closedOpen "text" [0,11,2,0] [1,3]@@ -22,12 +22,21 @@ containers :: Package containers = closedOpen "containers" [0,4,2,1] [0,6] -barecheck :: Package-barecheck = closedOpen "barecheck" [0,2,0,0] [0,3]- quickcheck :: Package-quickcheck = closedOpen "QuickCheck" [2,5] [2,8]+quickcheck = closedOpen "QuickCheck" [2,7] [2,9] +tasty :: Package+tasty = nextBreaking "tasty" [0,10]++tastyQuickcheck :: Package+tastyQuickcheck = nextBreaking "tasty-quickcheck" [0,8]++tastyTh :: Package+tastyTh = nextBreaking "tasty-th" [0,1]++bytestring :: Package+bytestring = nextBreaking "bytestring" [0,10]+ properties :: Properties properties = blank { name = "prednote"@@ -90,6 +99,7 @@ , containers , contravariant , transformers+ , bytestring ] library@@ -141,7 +151,9 @@ , otherModules (ls ++ ts) , ghcOptions ghcOpts , haskell2010- , buildDepends $ quickcheck : quickpull : libDepends+ , otherExtensions ["TemplateHaskell"]+ , buildDepends+ $ tasty : tastyQuickcheck : tastyTh : quickcheck : libDepends ] visualTests :: Applicative m => Betsy m FlagName
lib/Prednote/Comparisons.hs view
@@ -36,7 +36,6 @@ import qualified Prelude import Data.Monoid import qualified Data.Text as X-import Data.Text (Text) import Data.String import Rainbow @@ -67,7 +66,7 @@ mkTup ord = (bl, val, cond) where val = Value [fromString . show $ a]- cond = Condition [fromText condTxt]+ cond = Condition [chunkFromText condTxt] condTxt = "is" <+> ordDesc <+> rhsDesc ordDesc = case ord of EQ -> "equal to"@@ -131,7 +130,7 @@ f a = fmap mkTup (get a) where mkTup bl = (bl, Value [fromString . show $ a],- Condition [fromText $ "is equal to" <+> rhsDesc])+ Condition [chunkFromText $ "is equal to" <+> rhsDesc]) -- | Builds a 'Pred' that tests items for equality. @@ -184,7 +183,7 @@ mkTup mayOrd = (bl, val, cond) where val = Value [fromString . show $ a]- cond = Condition [fromText $ "is" <+> ordDesc <+> rhsDesc]+ cond = Condition [chunkFromText $ "is" <+> ordDesc <+> rhsDesc] ordDesc = case ord of EQ -> "equal to" LT -> "less than"
lib/Prednote/Core.hs view
@@ -67,15 +67,16 @@ ) where import Rainbow+import Rainbow.Types import Data.Monoid import Data.Functor.Contravariant import Prelude hiding (all, any, maybe, and, or, not) import qualified Prelude-import qualified System.IO as IO import qualified Data.Text as X import Data.List (intersperse) import Data.Functor.Identity import Control.Applicative+import qualified Data.ByteString as BS -- | Like 'contramap' but allows the mapping function to run in a -- monad.@@ -290,7 +291,7 @@ -- | Always returns its argument same :: Applicative f => PredM f Bool same = predicateM- (\b -> pure (b, (Value [(fromText . X.pack . show $ b)]),+ (\b -> pure (b, (Value [(chunkFromText . X.pack . show $ b)]), Condition ["is returned"])) -- | Adds descriptive text to a 'Pred'. Gives useful information for@@ -423,13 +424,13 @@ hyphen = [" - "] chunksNull :: [Chunk] -> Bool-chunksNull = Prelude.all $ Prelude.all X.null . text+chunksNull = Prelude.all $ Prelude.all X.null . chunkTexts indentAmt :: Int indentAmt = 2 spaces :: Int -> [Chunk]-spaces i = (:[]) . fromText . X.replicate (i * indentAmt)+spaces i = (:[]) . chunkFromText . X.replicate (i * indentAmt) . X.singleton $ ' ' newline :: [Chunk]@@ -491,7 +492,7 @@ verboseTestStdout :: Pred a -> a -> IO Bool verboseTestStdout p a = do let (cks, r) = verboseTest p a- t <- smartTermFromEnv IO.stdout- putChunks t cks+ mkr <- byteStringMakerFromEnvironment+ mapM_ BS.putStr . chunksToByteStrings mkr $ cks return r
prednote.cabal view
@@ -3,11 +3,11 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: genCabal.hs--- Generated on: 2015-03-09 21:41:29.216893 EDT+-- Generated on: 2015-03-22 11:33:59.14546 EDT -- Cartel library version: 0.14.2.0 name: prednote-version: 0.32.0.0+version: 0.32.0.4 cabal-version: >= 1.14 license: BSD3 license-file: LICENSE@@ -47,12 +47,13 @@ Prednote.Expressions.RPN build-depends: base >= 4.5.0.0 && < 5- , rainbow >= 0.20.0.4 && < 0.21+ , rainbow >= 0.22 && < 0.23 , split >= 0.2.2 && < 0.3 , text >= 0.11.2.0 && < 1.3 , containers >= 0.4.2.1 && < 0.6 , contravariant >= 1.2 && < 1.4 , transformers >= 0.3.0.0 && < 0.5+ , bytestring >= 0.10 && < 0.11 hs-source-dirs: lib ghc-options:@@ -70,24 +71,28 @@ Prednote.Expressions Prednote.Expressions.Infix Prednote.Expressions.RPN- Decrees Instances Prednote.Core.Instances Prednote.Core.Properties- Rainbow.Types.Instances+ Rainbow.Instances ghc-options: -Wall default-language: Haskell2010+ other-extensions:+ TemplateHaskell build-depends:- QuickCheck >= 2.5 && < 2.8- , quickpull >= 0.4 && < 0.5+ tasty >= 0.10 && < 0.11+ , tasty-quickcheck >= 0.8 && < 0.9+ , tasty-th >= 0.1 && < 0.2+ , QuickCheck >= 2.7 && < 2.9 , base >= 4.5.0.0 && < 5- , rainbow >= 0.20.0.4 && < 0.21+ , rainbow >= 0.22 && < 0.23 , split >= 0.2.2 && < 0.3 , text >= 0.11.2.0 && < 1.3 , containers >= 0.4.2.1 && < 0.6 , contravariant >= 1.2 && < 1.4 , transformers >= 0.3.0.0 && < 0.5+ , bytestring >= 0.10 && < 0.11 main-is: prednote-tests.hs type: exitcode-stdio-1.0 @@ -105,24 +110,28 @@ Prednote.Expressions Prednote.Expressions.Infix Prednote.Expressions.RPN- Decrees Instances Prednote.Core.Instances Prednote.Core.Properties- Rainbow.Types.Instances+ Rainbow.Instances ghc-options: -Wall default-language: Haskell2010+ other-extensions:+ TemplateHaskell build-depends:- QuickCheck >= 2.5 && < 2.8- , quickpull >= 0.4 && < 0.5+ tasty >= 0.10 && < 0.11+ , tasty-quickcheck >= 0.8 && < 0.9+ , tasty-th >= 0.1 && < 0.2+ , QuickCheck >= 2.7 && < 2.9 , base >= 4.5.0.0 && < 5- , rainbow >= 0.20.0.4 && < 0.21+ , rainbow >= 0.22 && < 0.23 , split >= 0.2.2 && < 0.3 , text >= 0.11.2.0 && < 1.3 , containers >= 0.4.2.1 && < 0.6 , contravariant >= 1.2 && < 1.4 , transformers >= 0.3.0.0 && < 0.5+ , bytestring >= 0.10 && < 0.11 else buildable: False
− tests/Decrees.hs
@@ -1,26 +0,0 @@--- | This module generated by the Quickpull package.--- Quickpull is available at:--- <http://www.github.com/massysett/quickpull>--module Decrees where--import Quickpull-import qualified Prednote.Core.Properties--decrees :: [Decree]-decrees =-- [ Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 14, qName = "prop_andIsLazyInSecondArgument"} ) ( Single Prednote.Core.Properties.prop_andIsLazyInSecondArgument )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 17, qName = "prop_orIsLazyInSecondArgument"} ) ( Single Prednote.Core.Properties.prop_orIsLazyInSecondArgument )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 23, qName = "prop_andIsLikePreludeAnd"} ) ( Single Prednote.Core.Properties.prop_andIsLikePreludeAnd )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 29, qName = "prop_orIsLikePreludeOr"} ) ( Single Prednote.Core.Properties.prop_orIsLikePreludeOr )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 35, qName = "prop_notIsLikePreludeNot"} ) ( Single Prednote.Core.Properties.prop_notIsLikePreludeNot )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 40, qName = "prop_switchIsLazyInFirstArgument"} ) ( Single Prednote.Core.Properties.prop_switchIsLazyInFirstArgument )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 45, qName = "prop_switchIsLazyInSecondArgument"} ) ( Single Prednote.Core.Properties.prop_switchIsLazyInSecondArgument )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 50, qName = "prop_switch"} ) ( Single Prednote.Core.Properties.prop_switch )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 60, qName = "prop_true"} ) ( Single Prednote.Core.Properties.prop_true )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 62, qName = "prop_false"} ) ( Single Prednote.Core.Properties.prop_false )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 64, qName = "prop_same"} ) ( Single Prednote.Core.Properties.prop_same )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 66, qName = "prop_any"} ) ( Single Prednote.Core.Properties.prop_any )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Prednote/Core/Properties.hs", modName = ["Prednote","Core","Properties"]}, linenum = 72, qName = "prop_all"} ) ( Single Prednote.Core.Properties.prop_all )- ]
tests/Prednote/Core/Instances.hs view
@@ -2,7 +2,7 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Prednote.Core.Instances where -import Rainbow.Types.Instances ()+import Rainbow.Instances () import Test.QuickCheck hiding (Result) import Control.Monad import Prednote.Core
tests/Prednote/Core/Properties.hs view
@@ -1,4 +1,5 @@ {-# OPTIONS_GHC -fno-warn-missing-signatures #-}+{-# LANGUAGE TemplateHaskell #-} module Prednote.Core.Properties where @@ -7,6 +8,12 @@ import Test.QuickCheck.Function import Prelude hiding (not, any, all) import qualified Prelude+import Test.Tasty+import Test.Tasty.QuickCheck+import Test.Tasty.TH++tests :: TestTree+tests = $(testGroupGenerator) testInt :: Pred Int -> Int -> Bool testInt = test
+ tests/Rainbow/Instances.hs view
@@ -0,0 +1,144 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# LANGUAGE FlexibleInstances, DeriveGeneric, StandaloneDeriving #-}++-- | QuickCheck instances for all of Rainbow. Currently Rainbow does+-- not use these instances itself; they are only here for+-- cut-and-paste for other libraries that may need them. There is an+-- executable in Rainbow that is built solely to make sure this module+-- compiles without any errors.+--+-- To use these instances, just drop them into your own project+-- somewhere. They are not packaged as a library because there are+-- orphan instances.++module Rainbow.Instances where++import Control.Applicative+import Test.QuickCheck+import Rainbow.Colors+import Rainbow.Types+import Data.Monoid+import Control.Monad+import qualified Data.Text as X++varInt :: Int -> Gen b -> Gen b+varInt = variant++instance Arbitrary Enum8 where+ arbitrary = elements [E0, E1, E2, E3, E4, E5, E6, E7]+ shrink = genericShrink++instance CoArbitrary Enum8 where+ coarbitrary x = case x of+ E0 -> varInt 0+ E1 -> varInt 1+ E2 -> varInt 2+ E3 -> varInt 3+ E4 -> varInt 4+ E5 -> varInt 5+ E6 -> varInt 6+ E7 -> varInt 7++instance Arbitrary Color8 where+ arbitrary = fmap Color8 arbitrary+ shrink = genericShrink++instance CoArbitrary Color8 where+ coarbitrary (Color8 Nothing) = varInt 0+ coarbitrary (Color8 (Just e)) = varInt 1 . coarbitrary e++instance Arbitrary Color256 where+ arbitrary = fmap Color256 arbitrary+ shrink = genericShrink++instance CoArbitrary Color256 where+ coarbitrary (Color256 Nothing) = varInt 0+ coarbitrary (Color256 (Just w)) = varInt 1 . coarbitrary w++instance Arbitrary (Last Color8) where+ arbitrary = fmap Last arbitrary++instance CoArbitrary (Last Color8) where+ coarbitrary (Last Nothing) = varInt 0+ coarbitrary (Last (Just c)) = varInt 1 . coarbitrary c++instance Arbitrary (Last Color256) where+ arbitrary = fmap Last arbitrary++instance CoArbitrary (Last Color256) where+ coarbitrary (Last Nothing) = varInt 0+ coarbitrary (Last (Just c)) = varInt 1 . coarbitrary c++instance Arbitrary (Last Bool) where+ arbitrary = fmap Last arbitrary++instance CoArbitrary (Last Bool) where+ coarbitrary (Last Nothing) = varInt 0+ coarbitrary (Last (Just b)) = varInt 1 . coarbitrary b++instance Arbitrary StyleCommon where+ arbitrary+ = StyleCommon <$> g <*> g <*> g <*> g <*> g <*> g <*> g <*> g+ where+ g = fmap Last arbitrary++instance CoArbitrary StyleCommon where+ coarbitrary (StyleCommon x0 x1 x2 x3 x4 x5 x6 x7)+ = coarbitrary x0+ . coarbitrary x1+ . coarbitrary x2+ . coarbitrary x3+ . coarbitrary x4+ . coarbitrary x5+ . coarbitrary x6+ . coarbitrary x7+ ++instance Arbitrary Style256 where+ arbitrary = liftM3 Style256 arbitrary arbitrary arbitrary++instance CoArbitrary Style256 where+ coarbitrary (Style256 x0 x1 x2)+ = coarbitrary x0+ . coarbitrary x1+ . coarbitrary x2++instance Arbitrary Style8 where+ arbitrary = liftM3 Style8 arbitrary arbitrary arbitrary++instance CoArbitrary Style8 where+ coarbitrary (Style8 x0 x1 x2)+ = coarbitrary x0+ . coarbitrary x1+ . coarbitrary x2++instance Arbitrary TextSpec where+ arbitrary = liftM2 TextSpec arbitrary arbitrary+ shrink = genericShrink++instance CoArbitrary TextSpec where+ coarbitrary (TextSpec x0 x1)+ = coarbitrary x0+ . coarbitrary x1++instance Arbitrary X.Text where+ arbitrary = fmap X.pack arbitrary+ shrink = map X.pack . shrink . X.unpack++instance Arbitrary Chunk where+ arbitrary = liftM2 Chunk arbitrary+ (listOf (fmap X.pack (listOf (elements ['a'..'z']))))+ shrink = genericShrink++instance CoArbitrary Chunk where+ coarbitrary (Chunk ts txts) = coarbitrary ts+ . coarbitrary (map X.unpack txts)++instance Arbitrary Radiant where+ arbitrary = liftM2 Radiant arbitrary arbitrary+ shrink = genericShrink++instance CoArbitrary Radiant where+ coarbitrary (Radiant x0 x1)+ = coarbitrary x0+ . coarbitrary x1
− tests/Rainbow/Types/Instances.hs
@@ -1,80 +0,0 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}-module Rainbow.Types.Instances where--import Control.Monad-import Control.Applicative-import Data.Monoid-import Test.QuickCheck-import Rainbow.Types-import qualified Data.Text as X--instance Arbitrary a => Arbitrary (Last a) where- arbitrary = Last <$> arbitrary--instance CoArbitrary a => CoArbitrary (Last a) where- coarbitrary (Last m) = case m of- Nothing -> varInt 0- Just x -> varInt 1 . coarbitrary x--instance Arbitrary Enum8 where- arbitrary = elements [ E0, E1, E2, E3, E4, E5, E6, E7 ]--varInt :: Int -> Gen b -> Gen b-varInt = variant--instance CoArbitrary Enum8 where- coarbitrary a = case a of- { E0 -> varInt 0; E1 -> varInt 1; E2 -> varInt 2; E3 -> varInt 3;- E4 -> varInt 4; E5 -> varInt 5; E6 -> varInt 6; E7 -> varInt 7 }--instance Arbitrary Color8 where- arbitrary = Color8 <$> arbitrary--instance CoArbitrary Color8 where- coarbitrary (Color8 a) = coarbitrary a--instance Arbitrary Color256 where- arbitrary = Color256 <$> arbitrary--instance CoArbitrary Color256 where- coarbitrary (Color256 a) = coarbitrary a--instance Arbitrary StyleCommon where- arbitrary = liftM4 StyleCommon arbitrary arbitrary arbitrary- arbitrary--instance CoArbitrary StyleCommon where- coarbitrary (StyleCommon a b c d) =- coarbitrary a . coarbitrary b . coarbitrary c . coarbitrary d--instance Arbitrary Style8 where- arbitrary = liftM3 Style8 arbitrary arbitrary arbitrary--instance CoArbitrary Style8 where- coarbitrary (Style8 a b c) =- coarbitrary a . coarbitrary b . coarbitrary c--instance Arbitrary Style256 where- arbitrary = liftM3 Style256 arbitrary arbitrary arbitrary--instance CoArbitrary Style256 where- coarbitrary (Style256 a b c) =- coarbitrary a . coarbitrary b . coarbitrary c--instance Arbitrary TextSpec where- arbitrary = liftM2 TextSpec arbitrary arbitrary--instance CoArbitrary TextSpec where- coarbitrary (TextSpec x y) = coarbitrary x . coarbitrary y--instance Arbitrary X.Text where- arbitrary = X.pack <$> listOf arbitrary--instance CoArbitrary X.Text where- coarbitrary = coarbitrary . X.unpack--instance Arbitrary Chunk where- arbitrary = liftM2 Chunk arbitrary arbitrary--instance CoArbitrary Chunk where- coarbitrary (Chunk x y) = coarbitrary x . coarbitrary y
tests/prednote-tests.hs view
@@ -1,8 +1,10 @@ {-# OPTIONS_GHC -fno-warn-unused-imports #-} module Main where -import Quickpull-import Decrees+import Test.Tasty+import qualified Prednote.Core.Properties main :: IO ()-main = defaultMain decrees+main = defaultMain $ testGroup "all tests"+ [ Prednote.Core.Properties.tests+ ]