packages feed

fb 0.7.2 → 0.7.3

raw patch · 3 files changed

+27/−5 lines, 3 filesdep ~hspecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hspec

API changes (from Hackage documentation)

Files

fb.cabal view
@@ -1,5 +1,5 @@ name:              fb-version:           0.7.2+version:           0.7.3 license:           BSD3 license-file:      LICENSE author:            Felipe Lessa@@ -90,7 +90,7 @@       -- Test-only dependencies     , HUnit     , QuickCheck-    , hspec == 0.9.*+    , hspec >= 0.9.1 && < 0.10     , fb   extensions:     TypeFamilies
src/Facebook/OpenGraph.hs view
@@ -10,6 +10,7 @@ -- import Control.Monad (mzero) -- import Data.ByteString.Char8 (ByteString) import Data.Function (on)+import Data.List (intersperse) import Data.Text (Text) -- import Data.Typeable (Typeable, Typeable1) import Data.Int (Int8, Int16, Int32)@@ -166,6 +167,15 @@ -- | Facebook's simple type @String@. instance SimpleType Text where     encodeFbParam = id++-- | A comma-separated list of simple types.  This definition+-- doesn't work everywhere, just for a few combinations that+-- Facebook uses (e.g. @[Int]@).  Also, encoding a list of lists+-- is the same as encoding the concatenation of all lists.  In+-- other words, this instance is here more for your convenience+-- than to make sure your code is correct.+instance SimpleType a => SimpleType [a] where+    encodeFbParam = T.concat . intersperse "," . map encodeFbParam  showT :: Show a => a -> Text showT = T.pack . show
tests/runtests.hs view
@@ -3,7 +3,6 @@ import Control.Applicative import Control.Monad.IO.Class (MonadIO(liftIO)) import Control.Monad.Trans.Class (lift)-import Control.Monad.Trans.Writer (Writer) import Data.Int (Int8, Int16, Int32) import Data.Text (Text) import Data.Time (parseTime)@@ -97,7 +96,7 @@               -> H.Manager               -> (forall a. FB.FacebookT FB.Auth   IO a -> IO a)               -> (forall a. FB.FacebookT FB.NoAuth IO a -> IO a)-              -> Writer [Spec] ()+              -> Specs facebookTests pretitle manager runAuth runNoAuth = do   let describe' = describe . (pretitle ++)   describe' "getAppAccessToken" $ do@@ -143,7 +142,7 @@         FB.userGender user     &?= Just FB.Male  -libraryTests :: Writer [Spec] ()+libraryTests :: Specs libraryTests = do   describe "SimpleType" $ do     it "works for Bool" $ (map FB.encodeFbParam [True, False]) @?= ["1", "0"]@@ -170,6 +169,19 @@     prop "works for Word8"  (propShowRead :: Word8  -> Bool)     prop "works for Word16" (propShowRead :: Word16 -> Bool)     prop "works for Word32" (propShowRead :: Word32 -> Bool)++    let propShowReadL :: (Show a, Read a, Eq a, FB.SimpleType a) => [a] -> Bool+        propShowReadL x = read ('[' : T.unpack (FB.encodeFbParam x) ++ "]") == x+    prop "works for [Float]"  (propShowReadL :: [Float]  -> Bool)+    prop "works for [Double]" (propShowReadL :: [Double] -> Bool)+    prop "works for [Int]"    (propShowReadL :: [Int]    -> Bool)+    prop "works for [Int8]"   (propShowReadL :: [Int8]   -> Bool)+    prop "works for [Int16]"  (propShowReadL :: [Int16]  -> Bool)+    prop "works for [Int32]"  (propShowReadL :: [Int32]  -> Bool)+    prop "works for [Word]"   (propShowReadL :: [Word]   -> Bool)+    prop "works for [Word8]"  (propShowReadL :: [Word8]  -> Bool)+    prop "works for [Word16]" (propShowReadL :: [Word16] -> Bool)+    prop "works for [Word32]" (propShowReadL :: [Word32] -> Bool)      prop "works for Text" (\t -> FB.encodeFbParam t == t)