haskell-persistent-template: New upstream version 0.8.1.1.
Clint Adams
12 years ago
0 | haskell-persistent-template (0.8.1.1-1) unstable; urgency=low | |
1 | ||
2 | * New upstream version. | |
3 | * Bump to Standards-Version 3.9.3. | |
4 | * Enable test suite, with test suite lifted from git. | |
5 | ||
6 | -- Clint Adams <clint@debian.org> Wed, 29 Feb 2012 10:52:09 -0500 | |
7 | ||
0 | 8 | haskell-persistent-template (0.6.3.1-1) unstable; urgency=low |
1 | 9 | |
2 | 10 | * New upstream version. |
8 | 8 | , ghc |
9 | 9 | , ghc-prof |
10 | 10 | , ghc-ghci |
11 | , libghc-aeson-dev | |
12 | , libghc-aeson-prof | |
11 | 13 | , libghc-monad-control-dev (>> 0.2) |
12 | 14 | , libghc-monad-control-dev (<< 0.4) |
13 | 15 | , libghc-monad-control-prof |
14 | , libghc-persistent-dev (>= 0.6.2) | |
15 | , libghc-persistent-dev (<< 0.7) | |
16 | , libghc-persistent-dev (>> 0.8) | |
17 | , libghc-persistent-dev (<< 0.9) | |
16 | 18 | , libghc-persistent-prof |
17 | 19 | , libghc-text-dev (>> 0.5) |
18 | 20 | , libghc-text-dev (<< 1.0) |
19 | 21 | , libghc-text-prof |
20 | 22 | , libghc-transformers-dev (>> 0.2) |
21 | 23 | , libghc-transformers-prof |
24 | , libghc-hspec-dev | |
25 | , libghc-hunit-dev | |
26 | , libghc-quickcheck2-dev | |
22 | 27 | Build-Depends-Indep: ghc-doc |
28 | , libghc-aeson-doc | |
23 | 29 | , libghc-monad-control-doc |
24 | 30 | , libghc-persistent-doc |
25 | 31 | , libghc-text-doc |
26 | 32 | , libghc-transformers-doc |
27 | Standards-Version: 3.9.2 | |
33 | Standards-Version: 3.9.3 | |
28 | 34 | Homepage: http://hackage.haskell.org/package/persistent-template |
29 | 35 | Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-persistent-template |
30 | 36 | Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-persistent-template |
0 | --- a/test/main.hs | |
1 | +++ b/test/main.hs | |
2 | @@ -1,4 +1,4 @@ | |
3 | -{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies, GADTs #-} | |
4 | +{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies, GADTs, EmptyDataDecls #-} | |
5 | import Test.Hspec.Monadic | |
6 | import Test.Hspec.QuickCheck | |
7 | import Test.Hspec.HUnit() |
0 | --- /dev/null | |
1 | +++ b/test/main.hs | |
2 | @@ -0,0 +1,48 @@ | |
3 | +{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies, GADTs #-} | |
4 | +import Test.Hspec.Monadic | |
5 | +import Test.Hspec.QuickCheck | |
6 | +import Test.Hspec.HUnit() | |
7 | +import Test.HUnit | |
8 | +import Data.ByteString.Lazy.Char8 () | |
9 | +import Test.QuickCheck.Arbitrary | |
10 | +import Control.Applicative ((<$>), (<*>)) | |
11 | + | |
12 | +import Database.Persist | |
13 | +import Database.Persist.TH | |
14 | +import Data.Text (Text, pack) | |
15 | +import Data.Aeson | |
16 | + | |
17 | +mkPersist sqlSettings [persistUpperCase| | |
18 | +Person json | |
19 | + name Text | |
20 | + age Int Maybe | |
21 | + address Address | |
22 | +Address json | |
23 | + street Text | |
24 | + city Text | |
25 | + zip Int Maybe | |
26 | +NoJson | |
27 | + foo Text | |
28 | +|] | |
29 | + | |
30 | +-- ensure no-json works | |
31 | +instance ToJSON (NoJsonGeneric b) where | |
32 | + toJSON = undefined | |
33 | +instance FromJSON (NoJsonGeneric b) where | |
34 | + parseJSON = undefined | |
35 | + | |
36 | +arbitraryT = pack <$> arbitrary | |
37 | + | |
38 | +instance Arbitrary (PersonGeneric b) where | |
39 | + arbitrary = Person <$> arbitraryT <*> arbitrary <*> arbitrary | |
40 | +instance Arbitrary (AddressGeneric b) where | |
41 | + arbitrary = Address <$> arbitraryT <*> arbitraryT <*> arbitrary | |
42 | + | |
43 | +main :: IO () | |
44 | +main = hspecX $ do | |
45 | + describe "JSON serialization" $ do | |
46 | + prop "to/from is idempotent" $ \person -> | |
47 | + decode (encode person) == Just (person :: Person) | |
48 | + it "decode" $ | |
49 | + decode "{\"name\":\"Michael\",\"age\":27,\"address\":{\"street\":\"Narkis\",\"city\":\"Maalot\"}}" @?= Just | |
50 | + (Person "Michael" (Just 27) $ Address "Narkis" "Maalot" Nothing) |