mirror of
https://github.com/typeable/hjsonpointer.git
synced 2024-08-16 10:00:21 +03:00
1.0.0.1: Remove HUnit dep.
This commit is contained in:
parent
950a7128e2
commit
4cf8c6f237
@ -1,5 +1,5 @@
|
||||
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
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -1,3 +1,7 @@
|
||||
# 1.0.0.1
|
||||
|
||||
+ Remove HUnit dep.
|
||||
|
||||
# 1.0.0.0
|
||||
|
||||
+ Bump aeson.
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: hjsonpointer
|
||||
version: 1.0.0.0
|
||||
version: 1.0.0.1
|
||||
synopsis: JSON Pointer library
|
||||
homepage: https://github.com/seagreen/hjsonpointer
|
||||
license: MIT
|
||||
@ -9,7 +9,6 @@ maintainer: ian@housejeffries.com
|
||||
category: Data
|
||||
build-type: Simple
|
||||
cabal-version: >=1.10
|
||||
tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1
|
||||
extra-source-files:
|
||||
changelog.md
|
||||
README.md
|
||||
@ -38,13 +37,13 @@ test-suite unit
|
||||
hs-source-dirs:
|
||||
test
|
||||
./
|
||||
main-is: Unit.hs
|
||||
default-language: Haskell2010
|
||||
type: exitcode-stdio-1.0
|
||||
default-extensions:
|
||||
OverloadedStrings
|
||||
ghc-options:
|
||||
-Wall
|
||||
type: exitcode-stdio-1.0
|
||||
main-is: Unit.hs
|
||||
other-modules: Example
|
||||
build-depends:
|
||||
aeson
|
||||
@ -56,7 +55,6 @@ test-suite unit
|
||||
, vector
|
||||
, hspec >= 2.2 && < 2.3
|
||||
, http-types >= 0.8 && < 0.10
|
||||
, HUnit >= 1.2 && < 1.4
|
||||
|
||||
source-repository head
|
||||
type: git
|
||||
|
15
test/Unit.hs
15
test/Unit.hs
@ -13,8 +13,6 @@ import Network.HTTP.Types.URI (urlDecode)
|
||||
import Test.Hspec
|
||||
import Test.QuickCheck (property)
|
||||
|
||||
import Test.HUnit hiding (Test)
|
||||
|
||||
-- For GHCs before 7.10:
|
||||
import Control.Applicative
|
||||
import Data.Foldable
|
||||
@ -34,7 +32,7 @@ main = hspec $ do
|
||||
roundtrip :: P.Pointer -> Bool
|
||||
roundtrip a = Just a == decode (encode a)
|
||||
|
||||
jsonString :: Assertion
|
||||
jsonString :: Expectation
|
||||
jsonString = traverse_ resolvesTo
|
||||
[ ("" , specExample)
|
||||
, ("/foo" , Array $ V.fromList ["bar", "baz"])
|
||||
@ -50,7 +48,7 @@ jsonString = traverse_ resolvesTo
|
||||
, ("/m~0n" , Number 8)
|
||||
]
|
||||
|
||||
uriFragment :: Assertion
|
||||
uriFragment :: Expectation
|
||||
uriFragment = traverse_ resolvesTo . fmap (first decodeFragment) $
|
||||
[ ("#" , specExample)
|
||||
, ("#/foo" , Array $ V.fromList ["bar", "baz"])
|
||||
@ -69,14 +67,11 @@ uriFragment = traverse_ resolvesTo . fmap (first decodeFragment) $
|
||||
decodeFragment :: Text -> Text
|
||||
decodeFragment = T.drop 1 . decodeUtf8 . urlDecode True . encodeUtf8
|
||||
|
||||
resolvesTo :: (Text, Value) -> Assertion
|
||||
resolvesTo :: (Text, Value) -> Expectation
|
||||
resolvesTo (t, expected) =
|
||||
case P.unescape t of
|
||||
Left e -> assertFailure (show e <> " error for pointer: " <> show t)
|
||||
Right p -> assertEqual
|
||||
("Resolved value for pointer: " <> show t)
|
||||
(Right expected)
|
||||
(P.resolve p specExample)
|
||||
Left e -> expectationFailure (show e <> " error for pointer: " <> show t)
|
||||
Right p -> P.resolve p specExample `shouldBe` Right expected
|
||||
|
||||
specExample :: Value
|
||||
specExample = object
|
||||
|
Loading…
Reference in New Issue
Block a user