packages feed

timezone-detect 0.3.0.0 → 0.3.0.1

raw patch · 3 files changed

+32/−4 lines, 3 filesdep +QuickCheckdep ~basePVP ok

version bump matches the API change (PVP)

Dependencies added: QuickCheck

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for timezone-detect +## v0.3.0.1 (2021-03-14)++* Adds property tests.+* Updates base to work with newer versions of Haskell.+ ## v0.3.0.0 (2020-09-02)  **Breaking Changes!**
test/TimezoneDetectSpec.hs view
@@ -3,6 +3,8 @@ import Data.Time import Data.Time.LocalTime.TimeZone.Detect import Test.Hspec+import Test.QuickCheck (oneof, choose, forAll, Gen)+import Data.Maybe (isNothing, isJust)  zoneFile :: FilePath zoneFile = "./test/tz_db/timezone21.bin"@@ -66,6 +68,14 @@                 let bogus = lookupTimeZoneName badDb 40.7831 (-73.9712)                 bogus `shouldBe` Nothing +            it "finds a timezone name for any latitude and longitude on Earth" $ \db -> do+                forAll genCoords $ \(a,b) ->+                    isJust $ lookupTimeZoneName db a b++            it "fails for any invalid set of coordinates" $ \db -> do+                forAll genBadCoords $ \(a,b) ->+                    isNothing $ lookupTimeZoneName db a b+         describe "timeAtPointToUTC" $ do             it "calculates a UTC instant at a point in time and space in New York" $ \db -> do                 localWinter <- localTimeFromString "2019-12-25 00:30:00"@@ -90,3 +100,15 @@                  atPointWinter `shouldBe` utcWinter                 atPointSummer `shouldBe` utcSummer++genCoords :: Gen (Double, Double)+genCoords = do+    lat <- choose (-90.0, 90.0)+    lng <- choose (-180.0, 180.0)+    return (lat, lng)++genBadCoords :: Gen (Double, Double)+genBadCoords = do+    lat <- oneof [choose (-360, -90), choose (90, 360)]+    lng <- oneof [choose (-360, -180), choose (180, 360)]+    return (lat, lng)
timezone-detect.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: cada8fe310ed1ed1c85911dc9e3b40c06e5e111b2984429f42aa5a762a956c9a+-- hash: 400585ad246f3ace6cd8038f78ddcb944512b6fc8a0756c20ba915afa995d67e  name:           timezone-detect-version:        0.3.0.0+version:        0.3.0.1 synopsis:       Haskell bindings for the zone-detect C library; plus tz-aware utils. description:    Please see the README on GitHub at <https://github.com/lfborjas/timezone-detect#readme> category:       Data, Foreign, Time@@ -42,7 +42,7 @@   c-sources:       csrc/zonedetect.c   build-depends:-      base >=4.9 && <4.14+      base >=4.9 && <=4.15     , time >=1.9.1 && <=1.10     , timezone-olson >=0.2.0 && <0.3     , timezone-series >=0.1.0 && <0.2@@ -60,7 +60,8 @@   build-tool-depends:       hspec-discover:hspec-discover >=2.7 && <2.8   build-depends:-      base >=4.9 && <4.14+      QuickCheck >=2.12 && <=2.14+    , base >=4.9 && <=4.15     , directory >=1.3 && <1.4     , hspec >=2.7 && <2.8     , time >=1.9.1 && <=1.10