state-codes 0.1.2 → 0.1.3
raw patch · 3 files changed
+14/−18 lines, 3 files
Files
src/Data/StateCodes/ISO31662US.hs view
@@ -1,11 +1,11 @@ -- The information used in this module was pulled from the @Wikipedia article -- about ISO_3166-2:US@: <https://en.wikipedia.org/wiki/ISO_3166-2:US>. +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-}--- Only if version 7.8 {-# LANGUAGE PatternGuards #-} module Data.StateCodes.ISO31662US@@ -21,13 +21,16 @@ , toText ) where -import Control.Applicative (pure) import Control.Arrow ((&&&)) import Data.Aeson import Data.Text (Text) import qualified Data.Text as T import Data.Typeable import Text.Shakespeare.I18N++#if !MIN_VERSION_base(4,8,0)+import Control.Applicative (pure)+#endif data StateCode = AL -- ^ Alabama | AK -- ^ Alaska
state-codes.cabal view
@@ -1,5 +1,5 @@ name: state-codes-version: 0.1.2+version: 0.1.3 synopsis: ISO 3166-2:US state codes and i18n names description: This package provides the ISO 3166-2:US state codes and i18n names homepage: https://github.com/acamino/state-codes#README
test/Data/StateCodesSpec.hs view
@@ -1,27 +1,20 @@-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS -fno-warn-orphans #-}- module Data.StateCodesSpec where import Data.Aeson-import qualified Data.Aeson as A import Test.Hspec import Test.Hspec.QuickCheck import Test.QuickCheck import Data.StateCodes -instance Arbitrary StateCode where- arbitrary = elements [minBound ..]-- spec :: Spec-spec = do- prop "fromName . toName" $ forAll arbitrary $ \code ->- (fromName . toName) code == code+spec =+ describe "StateCode" $ do+ prop "fromName . toName" $ forAll arbitraryBoundedEnum $ \code ->+ (fromName . toName) code == (code :: StateCode) - prop "fromText . toText" $ forAll arbitrary $ \code ->- (fromText . toText) code == code+ prop "fromText . toText" $ forAll arbitraryBoundedEnum $ \code ->+ (fromText . toText) code == (code :: StateCode) - prop "fromJSON . toJSON" $ forAll (arbitrary :: Gen StateCode)$ \code ->- (fromJSON . toJSON) code == A.Success code+ prop "decode . encode" $ forAll arbitraryBoundedEnum $ \code ->+ (decode . encode) code == Just (code :: StateCode)