greskell-core 0.1.2.5 → 0.1.2.6
raw patch · 3 files changed
+20/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−0
- greskell-core.cabal +2/−2
- test/Data/Greskell/GraphSONSpec.hs +13/−3
ChangeLog.md view
@@ -1,5 +1,10 @@ # Revision history for greskell-core +## 0.1.2.6 -- 2019-06-10++* Adapt test spec to `aeson-1.4.3.0` (#1).++ ## 0.1.2.5 -- 2019-03-31 * Confirm test with `QuickCheck-2.13.1`.
greskell-core.cabal view
@@ -1,5 +1,5 @@ name: greskell-core-version: 0.1.2.5+version: 0.1.2.6 author: Toshio Ito <debug.ito@gmail.com> maintainer: Toshio Ito <debug.ito@gmail.com> license: BSD3@@ -48,7 +48,7 @@ ghc-options: -Wall -fno-warn-unused-imports "-with-rtsopts=-M512m" main-is: Spec.hs -- default-extensions: - other-extensions: OverloadedStrings, NoMonomorphismRestriction+ other-extensions: OverloadedStrings, NoMonomorphismRestriction, CPP other-modules: Data.Greskell.GreskellSpec, Data.Greskell.GraphSONSpec, Data.Greskell.GMapSpec,
test/Data/Greskell/GraphSONSpec.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings, NoMonomorphismRestriction #-}+{-# LANGUAGE OverloadedStrings, NoMonomorphismRestriction, CPP #-} module Data.Greskell.GraphSONSpec (main,spec) where import Data.Aeson (object, (.=), ToJSON(..), FromJSON(..), Value(..))@@ -76,6 +76,16 @@ ] parse input `shouldBe` Right (nonTypedGraphSON input) +isParseTypeError :: String -- ^ expected type+ -> String -- ^ error message+ -> Bool -- ^ matched+#if MIN_VERSION_aeson(1,4,3)+isParseTypeError exp_type = isInfixOf ("parsing " <> exp_type <> " failed")+#else+isParseTypeError exp_type = isInfixOf ("expected " <> exp_type)+#endif++ parseTypedGraphSON_spec :: Spec parseTypedGraphSON_spec = describe "parseTypedGraphSON" $ do let parse = parseEither parseTypedGraphSON@@ -91,7 +101,7 @@ got `shouldSatisfy` (isInfixOf "Expected @type") specify "typed JSON with valid @type field and invalid @value" $ do let (Left got) = parse (object ["@type" .= String "g:Int32", "@value" .= String "hoge"]) :: Either String (GraphSON Int32)- got `shouldSatisfy` (isInfixOf "expected Int32")+ got `shouldSatisfy` isParseTypeError "Int32" specify "typed JSON with valid @type and @value" $ do let got = parse (object ["@type" .= String "g:Int32", "@value" .= Number 255]) :: Either String (GraphSON Int32) got `shouldBe` (Right $ typedGraphSON' "g:Int32" 255)@@ -111,7 +121,7 @@ let (Left got) = parse (object [ "@type" .= String "g:Array", "@value" .= Number 100 ]) :: Either String (GraphSON (HashMap String String))- got `shouldSatisfy` (isInfixOf "expected HashMap")+ got `shouldSatisfy` isParseTypeError "HashMap" specify "typed JSON with valid @type and @value" $ do let got = parse (object [ "@type" .= String "g:Map", "@value" .= object ["hoge" .= String "HOGE", "foo" .= String "FOO"]