From deca398e24ec1c4d339eebdbcee813d69a7f66d7 Mon Sep 17 00:00:00 2001 From: parsonsmatt Date: Mon, 10 Oct 2022 12:55:16 -0600 Subject: [PATCH 1/2] Case on bits in int --- persistent/test/Database/Persist/THSpec.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/persistent/test/Database/Persist/THSpec.hs b/persistent/test/Database/Persist/THSpec.hs index 52c056a06..600a6eefd 100644 --- a/persistent/test/Database/Persist/THSpec.hs +++ b/persistent/test/Database/Persist/THSpec.hs @@ -221,7 +221,10 @@ spec = describe "THSpec" $ do it "should have usual haskell name" $ do fieldHaskell `shouldBe` FieldNameHS "Id" it "should have correct underlying sql type" $ do - fieldSqlType `shouldBe` SqlInt64 + fieldSqlType `shouldBe` + if bitSizeMaybe (0 :: Int) <= Just 32 + then SqlInt32 + else SqlInt64 it "persistfieldsql should be right" $ do sqlType (Proxy @HasDefaultIdId) `shouldBe` SqlInt64 it "should have correct haskell type" $ do From 9622ce42ddd1c957e21508cb0c7284fd785cc6de Mon Sep 17 00:00:00 2001 From: parsonsmatt Date: Mon, 10 Oct 2022 13:15:36 -0600 Subject: [PATCH 2/2] ok tests pass --- persistent/test/Database/Persist/THSpec.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/persistent/test/Database/Persist/THSpec.hs b/persistent/test/Database/Persist/THSpec.hs index 600a6eefd..af59f8512 100644 --- a/persistent/test/Database/Persist/THSpec.hs +++ b/persistent/test/Database/Persist/THSpec.hs @@ -26,6 +26,7 @@ module Database.Persist.THSpec where import Control.Applicative (Const(..)) import Data.Aeson (decode, encode) +import Data.Bits (bitSizeMaybe) import Data.ByteString.Lazy.Char8 () import Data.Coerce import Data.Functor.Identity (Identity(..))