cartel 0.14.2.2 → 0.14.2.4
raw patch · 6 files changed
+110/−127 lines, 6 filesdep +tastydep +tasty-quickcheckdep +tasty-thdep −quickpullPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: tasty, tasty-quickcheck, tasty-th
Dependencies removed: quickpull
API changes (from Hackage documentation)
- Cartel.GenCartelCabal: quickpull :: Package
+ Cartel.GenCartelCabal: tasty :: Package
+ Cartel.GenCartelCabal: tastyQuickcheck :: Package
+ Cartel.GenCartelCabal: tastyTh :: Package
Files
- cartel.cabal +11/−9
- lib/Cartel/GenCartelCabal.hs +12/−4
- lib/Cartel/Version.hs +1/−1
- tests/Cartel/Properties.hs +0/−84
- tests/Decrees.hs +0/−26
- tests/cartel-properties.hs +86/−3
cartel.cabal view
@@ -3,11 +3,11 @@ -- http://www.github.com/massysett/cartel -- -- Script name used to generate: GenCartelCabal.hs--- Generated on: 2015-03-20 00:04:34.646237 EDT--- Cartel library version: 0.14.2.2+-- Generated on: 2015-03-22 10:19:15.62876 EDT+-- Cartel library version: 0.14.2.4 name: cartel-version: 0.14.2.2+version: 0.14.2.4 cabal-version: >= 1.16 license: BSD3 license-file: LICENSE@@ -64,15 +64,15 @@ buildable: True other-modules: Cartel.Generators- Cartel.Properties- Decrees hs-source-dirs: tests build-depends: multiarg >= 0.30.0.0 && < 0.31 , QuickCheck >= 2.7 && < 2.9 , random >= 1.0.1.1 && < 1.2- , quickpull >= 0.4.0.0 && < 0.5+ , tasty >= 0.10 && < 0.11+ , tasty-th >= 0.1 && < 0.2+ , tasty-quickcheck >= 0.8 && < 0.9 ghc-options: -Wall hs-source-dirs:@@ -92,15 +92,17 @@ default-language: Haskell2010 other-modules: Cartel.Generators- Cartel.Properties- Decrees+ other-extensions:+ TemplateHaskell hs-source-dirs: tests build-depends: multiarg >= 0.30.0.0 && < 0.31 , QuickCheck >= 2.7 && < 2.9 , random >= 1.0.1.1 && < 1.2- , quickpull >= 0.4.0.0 && < 0.5+ , tasty >= 0.10 && < 0.11+ , tasty-th >= 0.1 && < 0.2+ , tasty-quickcheck >= 0.8 && < 0.9 ghc-options: -Wall hs-source-dirs:
lib/Cartel/GenCartelCabal.hs view
@@ -25,6 +25,15 @@ quickcheck :: Package 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]+ random :: Package random = closedOpen "random" [1,0,1,1] [1,2] @@ -34,15 +43,13 @@ multiarg :: Package multiarg = nextBreaking "multiarg" [0,30,0,0] -quickpull :: Package-quickpull = nextBreaking "quickpull" [0,4,0,0]- libDepends :: [Package] libDepends = [ base, directory, filepath, time, transformers ] testDepends :: [Package]-testDepends = [ multiarg, quickcheck, random, quickpull ]+testDepends+ = [ multiarg, quickcheck, random, tasty, tastyTh, tastyQuickcheck ] commonOptions :: HasBuildInfo a => [a] commonOptions =@@ -110,6 +117,7 @@ , testSuite "cartel-properties" $ haskell2010 : otherModules testMods + : otherExtensions ["TemplateHaskell"] : testOptions ++ exitcodeFields "cartel-properties.hs"
lib/Cartel/Version.hs view
@@ -11,4 +11,4 @@ import Data.Word version :: [Word]-version = [0,14,2,2]+version = [0,14,2,4]
− tests/Cartel/Properties.hs
@@ -1,84 +0,0 @@-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}---- | Cartel properties. For the time being, most (maybe all) of these--- properties test the generators, rather than Cartel itself. I had--- to debug generators that were stuck in an infinite loop.-module Cartel.Properties where--import Cartel-import Cartel.Ast-import Control.Monad-import Test.QuickCheck-import qualified Cartel.Generators as G--seconds :: Int -> Int-seconds = (* 10 ^ (6 :: Int))--newtype Little = Little Word- deriving (Eq, Ord, Show)--instance Arbitrary Little where- arbitrary = sized f- where- f sz = fmap Little (choose (0, min (fromIntegral sz) 10))--completesInSecs- :: Show a- => Int- -- ^ How many seconds- -> G.Gen a- -> Little- -- ^ How many flags- -> Little- -- ^ Size- -> Int- -- ^ Seed- -> Property-completesInSecs time gen (Little nFlags) (Little sz) sd- = within (seconds time) $- length (show (G.genResult gen nFlags sz sd)) >= 0--prop_vcsCompletesInSecs = completesInSecs 10 (G.arbitrary :: G.Gen Vcs)--prop_constraintCompletesInSecs = completesInSecs 10- (G.arbitrary :: G.Gen Constraint)--mainIsCompletesInSecs a = completesInSecs 10 (G.genMainIs `asTypeOf` a)--prop_conditionCompletesInSecs = completesInSecs 10- (G.arbitrary :: G.Gen Condition)--buildInfoCompletesInSecs a = completesInSecs 10 (G.genBuildInfo `asTypeOf` a)---- ExecutableField contents--prop_buildInfoExeCompletesInSecs = buildInfoCompletesInSecs- (undefined :: G.Gen ExecutableField)--prop_condBlockExeCompletesInSecs = completesInSecs 10- (G.genCondBlock :: G.Gen ExecutableField)--prop_exeMainIsCompletesInSecs = mainIsCompletesInSecs- (undefined :: G.Gen ExecutableField)--prop_cabalCompletesInSecs = completesInSecs 10- (G.arbitrary :: G.Gen Cabal)--prop_propertiesCompletesInSecs = completesInSecs 10- (G.arbitrary :: G.Gen Properties)--prop_repositoryCompletesInSecs = completesInSecs 10- (G.arbitrary :: G.Gen Repository)--prop_sectionCompletesInSecs = completesInSecs 10- (G.arbitrary :: G.Gen Section)--prop_executableCompletesInSecs = completesInSecs 10- (liftM2 executable G.genNonEmptyString G.arbitrary)--prop_benchmarkCompletesInSecs = completesInSecs 10- (liftM2 benchmark G.genNonEmptyString G.arbitrary)--prop_testSuiteCompletesInSecs = completesInSecs 10- (liftM2 testSuite G.genNonEmptyString G.arbitrary)-
− 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 Cartel.Properties--decrees :: [Decree]-decrees =-- [ Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 41, qName = "prop_vcsCompletesInSecs"} ) ( Single Cartel.Properties.prop_vcsCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 43, qName = "prop_constraintCompletesInSecs"} ) ( Single Cartel.Properties.prop_constraintCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 48, qName = "prop_conditionCompletesInSecs"} ) ( Single Cartel.Properties.prop_conditionCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 55, qName = "prop_buildInfoExeCompletesInSecs"} ) ( Single Cartel.Properties.prop_buildInfoExeCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 58, qName = "prop_condBlockExeCompletesInSecs"} ) ( Single Cartel.Properties.prop_condBlockExeCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 61, qName = "prop_exeMainIsCompletesInSecs"} ) ( Single Cartel.Properties.prop_exeMainIsCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 64, qName = "prop_cabalCompletesInSecs"} ) ( Single Cartel.Properties.prop_cabalCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 67, qName = "prop_propertiesCompletesInSecs"} ) ( Single Cartel.Properties.prop_propertiesCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 70, qName = "prop_repositoryCompletesInSecs"} ) ( Single Cartel.Properties.prop_repositoryCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 73, qName = "prop_sectionCompletesInSecs"} ) ( Single Cartel.Properties.prop_sectionCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 76, qName = "prop_executableCompletesInSecs"} ) ( Single Cartel.Properties.prop_executableCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 79, qName = "prop_benchmarkCompletesInSecs"} ) ( Single Cartel.Properties.prop_benchmarkCompletesInSecs )- , Decree ( Meta {modDesc = ModDesc {modPath = "tests/Cartel/Properties.hs", modName = ["Cartel","Properties"]}, linenum = 82, qName = "prop_testSuiteCompletesInSecs"} ) ( Single Cartel.Properties.prop_testSuiteCompletesInSecs )- ]
tests/cartel-properties.hs view
@@ -1,7 +1,90 @@+{-# OPTIONS_GHC -fno-warn-missing-signatures #-}+{-# LANGUAGE TemplateHaskell #-}++-- | Cartel properties. For the time being, most (maybe all) of these+-- properties test the generators, rather than Cartel itself. I had+-- to debug generators that were stuck in an infinite loop. module Main where -import Quickpull-import Decrees+import Cartel+import Cartel.Ast+import Control.Monad+import Test.QuickCheck+import qualified Cartel.Generators as G+import Test.Tasty.QuickCheck+import Test.Tasty.TH main :: IO ()-main = defaultMain decrees+main = $(defaultMainGenerator)++seconds :: Int -> Int+seconds = (* 10 ^ (6 :: Int))++newtype Little = Little Word+ deriving (Eq, Ord, Show)++instance Arbitrary Little where+ arbitrary = sized f+ where+ f sz = fmap Little (choose (0, min (fromIntegral sz) 10))++completesInSecs+ :: Show a+ => Int+ -- ^ How many seconds+ -> G.Gen a+ -> Little+ -- ^ How many flags+ -> Little+ -- ^ Size+ -> Int+ -- ^ Seed+ -> Property+completesInSecs time gen (Little nFlags) (Little sz) sd+ = within (seconds time) $+ length (show (G.genResult gen nFlags sz sd)) >= 0++prop_vcsCompletesInSecs = completesInSecs 10 (G.arbitrary :: G.Gen Vcs)++prop_constraintCompletesInSecs = completesInSecs 10+ (G.arbitrary :: G.Gen Constraint)++mainIsCompletesInSecs a = completesInSecs 10 (G.genMainIs `asTypeOf` a)++prop_conditionCompletesInSecs = completesInSecs 10+ (G.arbitrary :: G.Gen Condition)++buildInfoCompletesInSecs a = completesInSecs 10 (G.genBuildInfo `asTypeOf` a)++-- ExecutableField contents++prop_buildInfoExeCompletesInSecs = buildInfoCompletesInSecs+ (undefined :: G.Gen ExecutableField)++prop_condBlockExeCompletesInSecs = completesInSecs 10+ (G.genCondBlock :: G.Gen ExecutableField)++prop_exeMainIsCompletesInSecs = mainIsCompletesInSecs+ (undefined :: G.Gen ExecutableField)++prop_cabalCompletesInSecs = completesInSecs 10+ (G.arbitrary :: G.Gen Cabal)++prop_propertiesCompletesInSecs = completesInSecs 10+ (G.arbitrary :: G.Gen Properties)++prop_repositoryCompletesInSecs = completesInSecs 10+ (G.arbitrary :: G.Gen Repository)++prop_sectionCompletesInSecs = completesInSecs 10+ (G.arbitrary :: G.Gen Section)++prop_executableCompletesInSecs = completesInSecs 10+ (liftM2 executable G.genNonEmptyString G.arbitrary)++prop_benchmarkCompletesInSecs = completesInSecs 10+ (liftM2 benchmark G.genNonEmptyString G.arbitrary)++prop_testSuiteCompletesInSecs = completesInSecs 10+ (liftM2 testSuite G.genNonEmptyString G.arbitrary)+