git.iko.soy/typeable/hjsonpointer
on master help sign in
0.3.0.2. Switch to hspec for tests.
92621b1Ian Grant Jeffries
Example.hs+1−1
@@ -1,6 +1,6 @@
1{-# LANGUAGE OverloadedStrings #-}
1{-# LANGUAGE OverloadedStrings #-}
2
2
3−module Main where
3+module Example where
4
4
5import Control.Monad (unless)
5import Control.Monad (unless)
6import Data.Aeson
6import Data.Aeson
changelog.md+9−1
@@ -1,4 +1,12 @@
1−# 0.3
1+# 0.3.0.2
2+
3++ Switch to hspec for tests.
4+
5+# 0.3.0.1
6+
7++ Enable GHC 8.
8+
9+# 0.3.0.0
2
10
3+ Rewrite.
11+ Rewrite.
4
12
hjsonpointer.cabal+9−16
@@ -1,5 +1,5 @@
1name: hjsonpointer
1name: hjsonpointer
2−version: 0.3.0.1
2+version: 0.3.0.2
3synopsis: JSON Pointer library
3synopsis: JSON Pointer library
4homepage: https://github.com/seagreen/hjsonpointer
4homepage: https://github.com/seagreen/hjsonpointer
5license: MIT
5license: MIT
@@ -22,37 +22,30 @@ library
22 ghc-options: -Wall
22 ghc-options: -Wall
23 build-depends: aeson >= 0.7 && < 0.12
23 build-depends: aeson >= 0.7 && < 0.12
24 , base >= 4.6 && < 4.10
24 , base >= 4.6 && < 4.10
25− , QuickCheck >= 2.8 && < 2.9
25+ , QuickCheck >= 2.8 && < 2.10
26 , unordered-containers >= 0.2 && < 0.3
26 , unordered-containers >= 0.2 && < 0.3
27 , text >= 1.2 && < 1.3
27 , text >= 1.2 && < 1.3
28 , vector >= 0.10 && < 0.12
28 , vector >= 0.10 && < 0.12
29
29
30test-suite unit
30test-suite unit
31 type: exitcode-stdio-1.0
31 type: exitcode-stdio-1.0
32− hs-source-dirs: tests
32+ hs-source-dirs: test
33+ ./
33 main-is: Unit.hs
34 main-is: Unit.hs
35+ other-modules: Example
34 default-language: Haskell2010
36 default-language: Haskell2010
35 ghc-options: -Wall
37 ghc-options: -Wall
36 default-extensions: OverloadedStrings
38 default-extensions: OverloadedStrings
37 build-depends: aeson
39 build-depends: aeson
38 , base
40 , base
39 , hjsonpointer
41 , hjsonpointer
42+ , QuickCheck
40 , unordered-containers
43 , unordered-containers
41 , text
44 , text
42 , vector
45 , vector
46+ , hspec >= 2.2 && < 2.3
43− , http-types >= 0.8 && < 0.10
47+ , http-types >= 0.8 && < 0.10
44− , HUnit >= 1.2 && < 1.4
48+ , HUnit >= 1.2 && < 1.4
45− , test-framework >= 0.8 && < 0.9
46− , test-framework-hunit >= 0.3 && < 0.4
47− , test-framework-quickcheck2 >= 0.3 && < 0.4
48−
49−executable example
50− main-is: Example.hs
51− default-language: Haskell2010
52− ghc-options: -Wall
53− build-depends: aeson
54− , base
55− , hjsonpointer
56
49
57source-repository head
50source-repository head
58 type: git
51 type: git
tests/Unit.hs → test/Unit.hsrenamed+13−10
@@ -9,9 +9,10 @@ import qualified Data.Text as T
9import Data.Text.Encoding
9import Data.Text.Encoding
10import qualified Data.Vector as V
10import qualified Data.Vector as V
11import Network.HTTP.Types.URI (urlDecode)
11import Network.HTTP.Types.URI (urlDecode)
12−import Test.Framework (defaultMain, testGroup)
12+
13−import Test.Framework.Providers.HUnit (testCase)
13+import Test.Hspec
14−import Test.Framework.Providers.QuickCheck2 (testProperty)
14+import Test.QuickCheck (property)
15+
15import Test.HUnit hiding (Test)
16import Test.HUnit hiding (Test)
16
17
17-- For GHCs before 7.10:
18-- For GHCs before 7.10:
@@ -19,14 +20,16 @@ import Control.Applicative
19import Data.Foldable
20import Data.Foldable
20import Data.Monoid
21import Data.Monoid
21
22
23+import qualified Example
24+
22main :: IO ()
25main :: IO ()
23−main = defaultMain
26+main = hspec $ do
24− [ testGroup "unit"
27+ describe "example" $ do
25− [ testProperty "Storing a Pointer as JSON doesn't change its value" roundtrip
28+ it "compiles and runs without errors" Example.main
29+ describe "pointers" $ do
30+ it "can be stored as JSON without changing its value" (property roundtrip)
26− , testCase "Can be represented in a JSON string value" jsonString
31+ it "can be represented in a JSON string value" jsonString
27− , testCase "Can be represented in a URI fragment identifier" uriFragment
32+ it "can be represented in a URI fragment identifier" uriFragment
28− ]
29− ]
30
33
31roundtrip :: P.Pointer -> Bool
34roundtrip :: P.Pointer -> Bool
32roundtrip a = Just a == decode (encode a)
35roundtrip a = Just a == decode (encode a)