1.0.0.1: Remove HUnit dep.

This commit is contained in:
Ian Grant Jeffries 2016-10-07 13:29:50 -04:00
parent 950a7128e2
commit 4cf8c6f237
4 changed files with 19 additions and 22 deletions

View File

@ -1,5 +1,5 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2015 Ian Grant Jeffries Copyright (c) 2016 Ian Grant Jeffries
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,3 +1,7 @@
# 1.0.0.1
+ Remove HUnit dep.
# 1.0.0.0 # 1.0.0.0
+ Bump aeson. + Bump aeson.

View File

@ -1,5 +1,5 @@
name: hjsonpointer name: hjsonpointer
version: 1.0.0.0 version: 1.0.0.1
synopsis: JSON Pointer library synopsis: JSON Pointer library
homepage: https://github.com/seagreen/hjsonpointer homepage: https://github.com/seagreen/hjsonpointer
license: MIT license: MIT
@ -9,7 +9,6 @@ maintainer: ian@housejeffries.com
category: Data category: Data
build-type: Simple build-type: Simple
cabal-version: >=1.10 cabal-version: >=1.10
tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1
extra-source-files: extra-source-files:
changelog.md changelog.md
README.md README.md
@ -38,13 +37,13 @@ test-suite unit
hs-source-dirs: hs-source-dirs:
test test
./ ./
main-is: Unit.hs
default-language: Haskell2010 default-language: Haskell2010
type: exitcode-stdio-1.0
default-extensions: default-extensions:
OverloadedStrings OverloadedStrings
ghc-options: ghc-options:
-Wall -Wall
type: exitcode-stdio-1.0
main-is: Unit.hs
other-modules: Example other-modules: Example
build-depends: build-depends:
aeson aeson
@ -56,7 +55,6 @@ test-suite unit
, vector , vector
, hspec >= 2.2 && < 2.3 , hspec >= 2.2 && < 2.3
, http-types >= 0.8 && < 0.10 , http-types >= 0.8 && < 0.10
, HUnit >= 1.2 && < 1.4
source-repository head source-repository head
type: git type: git

View File

@ -3,17 +3,15 @@ module Main where
import Control.Arrow import Control.Arrow
import Data.Aeson import Data.Aeson
import qualified Data.Aeson.Pointer as P import qualified Data.Aeson.Pointer as P
import Data.Text (Text) import Data.Text (Text)
import qualified Data.Text as T import qualified Data.Text as T
import Data.Text.Encoding import Data.Text.Encoding
import qualified Data.Vector as V import qualified Data.Vector as V
import Network.HTTP.Types.URI (urlDecode) import Network.HTTP.Types.URI (urlDecode)
import Test.Hspec import Test.Hspec
import Test.QuickCheck (property) import Test.QuickCheck (property)
import Test.HUnit hiding (Test)
-- For GHCs before 7.10: -- For GHCs before 7.10:
import Control.Applicative import Control.Applicative
@ -34,7 +32,7 @@ main = hspec $ do
roundtrip :: P.Pointer -> Bool roundtrip :: P.Pointer -> Bool
roundtrip a = Just a == decode (encode a) roundtrip a = Just a == decode (encode a)
jsonString :: Assertion jsonString :: Expectation
jsonString = traverse_ resolvesTo jsonString = traverse_ resolvesTo
[ ("" , specExample) [ ("" , specExample)
, ("/foo" , Array $ V.fromList ["bar", "baz"]) , ("/foo" , Array $ V.fromList ["bar", "baz"])
@ -50,7 +48,7 @@ jsonString = traverse_ resolvesTo
, ("/m~0n" , Number 8) , ("/m~0n" , Number 8)
] ]
uriFragment :: Assertion uriFragment :: Expectation
uriFragment = traverse_ resolvesTo . fmap (first decodeFragment) $ uriFragment = traverse_ resolvesTo . fmap (first decodeFragment) $
[ ("#" , specExample) [ ("#" , specExample)
, ("#/foo" , Array $ V.fromList ["bar", "baz"]) , ("#/foo" , Array $ V.fromList ["bar", "baz"])
@ -69,14 +67,11 @@ uriFragment = traverse_ resolvesTo . fmap (first decodeFragment) $
decodeFragment :: Text -> Text decodeFragment :: Text -> Text
decodeFragment = T.drop 1 . decodeUtf8 . urlDecode True . encodeUtf8 decodeFragment = T.drop 1 . decodeUtf8 . urlDecode True . encodeUtf8
resolvesTo :: (Text, Value) -> Assertion resolvesTo :: (Text, Value) -> Expectation
resolvesTo (t, expected) = resolvesTo (t, expected) =
case P.unescape t of case P.unescape t of
Left e -> assertFailure (show e <> " error for pointer: " <> show t) Left e -> expectationFailure (show e <> " error for pointer: " <> show t)
Right p -> assertEqual Right p -> P.resolve p specExample `shouldBe` Right expected
("Resolved value for pointer: " <> show t)
(Right expected)
(P.resolve p specExample)
specExample :: Value specExample :: Value
specExample = object specExample = object