@@ -3,17 +3,15 @@ module Main where
33
44import Control.Arrow
55import Data.Aeson
6−import qualified Data.Aeson.Pointer as P
7−import Data.Text (Text)
8−import qualified Data.Text as T
6+import qualified Data.Aeson.Pointer as P
7+import Data.Text (Text)
8+import qualified Data.Text as T
99import Data.Text.Encoding
10−import qualified Data.Vector as V
11−import Network.HTTP.Types.URI (urlDecode)
10+import qualified Data.Vector as V
11+import Network.HTTP.Types.URI (urlDecode)
1212
1313import Test.Hspec
14−import Test.QuickCheck (property)
15−
16−import Test.HUnit hiding (Test)
14+import Test.QuickCheck (property)
1715
1816-- For GHCs before 7.10:
1917import Control.Applicative
@@ -34,7 +32,7 @@ main = hspec $ do
3432roundtrip :: P.Pointer -> Bool
3533roundtrip a = Just a == decode (encode a)
3634
37−jsonString :: Assertion
35+jsonString :: Expectation
3836jsonString = traverse_ resolvesTo
3937 [ ("" , specExample)
4038 , ("/foo" , Array $ V.fromList ["bar", "baz"])
@@ -50,7 +48,7 @@ jsonString = traverse_ resolvesTo
5048 , ("/m~0n" , Number 8)
5149 ]
5250
53−uriFragment :: Assertion
51+uriFragment :: Expectation
5452uriFragment = traverse_ resolvesTo . fmap (first decodeFragment) $
5553 [ ("#" , specExample)
5654 , ("#/foo" , Array $ V.fromList ["bar", "baz"])
@@ -69,14 +67,11 @@ uriFragment = traverse_ resolvesTo . fmap (first decodeFragment) $
6967 decodeFragment :: Text -> Text
7068 decodeFragment = T.drop 1 . decodeUtf8 . urlDecode True . encodeUtf8
7169
72−resolvesTo :: (Text, Value) -> Assertion
70+resolvesTo :: (Text, Value) -> Expectation
7371resolvesTo (t, expected) =
7472 case P.unescape t of
75− Left e -> assertFailure (show e <> " error for pointer: " <> show t)
76− Right p -> assertEqual
77− ("Resolved value for pointer: " <> show t)
78− (Right expected)
79− (P.resolve p specExample)
73+ Left e -> expectationFailure (show e <> " error for pointer: " <> show t)
74+ Right p -> P.resolve p specExample `shouldBe` Right expected
8075
8176specExample :: Value
8277specExample = object