convertible-text 0.2.0.3 → 0.2.0.4
raw patch · 2 files changed
+17/−15 lines, 2 filesdep +test-framework-quickcheck2dep −test-framework-quickcheckdep ~QuickCheckPVP ok
version bump matches the API change (PVP)
Dependencies added: test-framework-quickcheck2
Dependencies removed: test-framework-quickcheck
Dependency ranges changed: QuickCheck
API changes (from Hackage documentation)
Files
Data/Convertible/Instances/String.hs view
@@ -42,15 +42,14 @@ import qualified Data.Text.Lazy as LT import Data.Time.Calendar+import Data.Ratio #if TEST import Test.Framework (testGroup, Test) --import Test.Framework.Providers.HUnit-import Test.Framework.Providers.QuickCheck (testProperty)+import Test.Framework.Providers.QuickCheck2 (testProperty) --import Test.HUnit hiding (Test, path)-import Test.QuickCheck import Data.Char (isDigit)-import Data.Ratio ((%)) #endif $(deriveAttempts@@ -147,19 +146,13 @@ -- Rational instance ConvertSuccess Rational [Char] where- convertSuccess = show . (fromRational :: Rational -> Double)+ convertSuccess r+ | denominator r == 1 = show $ numerator r+ | otherwise = show $ (fromRational r :: Double) instance ConvertAttempt [Char] Rational where convertAttempt = fmap realToFrac . (SF.read :: String -> Attempt Double) #if TEST-instance Arbitrary Rational where- coarbitrary = undefined- arbitrary = do- n <- arbitrary- d' <- arbitrary- let d = if d' == 0 then 1 else d'- return (n % d)- propRationalId :: Rational -> Bool propRationalId r = convertAttempt (convertSuccess r :: String) `almostEquals` r @@ -244,5 +237,14 @@ testSuite = testGroup "Data.Convertible.Instances.String" [ testProperty "propRationalId" propRationalId , testProperty "propRationalAllDigits" propRationalAllDigits+ , testProperty "propRationalAllNums" propRationalAllNums ]++propRationalAllNums :: Integer -> Bool+propRationalAllNums i = go (i % 1) where+ go :: Rational -> Bool+ go r+ | r < 0 = go $ negate r+ | otherwise = all isDigit $ cs r+ #endif
convertible-text.cabal view
@@ -1,5 +1,5 @@ Name: convertible-text-Version: 0.2.0.3+Version: 0.2.0.4 License: LGPL Maintainer: Michael Snoyman <michael@snoyman.com> Author: John Goerzen, Michael Snoyman@@ -70,10 +70,10 @@ Buildable: True cpp-options: -DTEST build-depends: test-framework,- test-framework-quickcheck,+ test-framework-quickcheck2, test-framework-hunit, HUnit,- QuickCheck >= 1 && < 2+ QuickCheck >= 2 && < 3 else Buildable: False ghc-options: -Wall