@@ -47,15 +47,15 @@ testTime :: TestEnv -> Test
4747testTime env@TestEnv{..} = TestCase $ do
4848 initializeTable env
4949 execute_ conn "SET timezone TO 'UTC'"
50− checkRoundTrips env
50+ checkRoundTrips env "1860-01-01 00:00:00+00"
5151 execute_ conn "SET timezone TO 'America/Chicago'" -- -5:00
52− checkRoundTrips env
52+ checkRoundTrips env "1883-11-18 12:00:00-06"
5353 execute_ conn "SET timezone TO 'Asia/Tokyo'" -- +9:00
54− checkRoundTrips env
54+ checkRoundTrips env "1888-01-01 00:00:00+09"
5555 execute_ conn "SET timezone TO 'Asia/Kathmandu'" -- +5:45
56− checkRoundTrips env
56+ checkRoundTrips env "1919-12-31 23:48:44+05:30"
5757 execute_ conn "SET timezone TO 'America/St_Johns'" -- -3:30
58− checkRoundTrips env
58+ checkRoundTrips env "1935-03-30 00:00:52-03:30"
5959
6060initializeTable :: TestEnv -> IO ()
6161initializeTable TestEnv{..} = withTransaction conn $ do
@@ -102,10 +102,19 @@ initializeTable TestEnv{..} = withTransaction conn $ do
102102 pop "100 milliseconds" 6.3113904e10
103103 pop "1 second" 6.3113904e9
104104
105−checkRoundTrips :: TestEnv -> IO ()
106−checkRoundTrips TestEnv{..} = do
105+checkRoundTrips :: TestEnv -> ByteString -> IO ()
106+checkRoundTrips TestEnv{..} limit = do
107107 yxs :: [(UTCTime, Int)] <- query_ conn [sql| SELECT y, x FROM testtime |]
108108 forM_ yxs $ \yx -> do
109109 res <- query conn [sql| SELECT y=? FROM testtime WHERE x=? |] yx
110110 assertBool "UTCTime did not round-trip from SQL to Haskell and back" $
111111 res == [Only True]
112+
113+
114+ yxs :: [(ZonedTime, Int)] <- query conn [sql|
115+ SELECT y, x FROM testtime WHERE y > ?
116+ |] (Only limit)
117+ forM_ yxs $ \yx -> do
118+ res <- query conn [sql| SELECT y=? FROM testtime WHERE x=? |] yx
119+ assertBool "ZonedTime did not round-trip from SQL to Haskell and back" $
120+ res == [Only True]