Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case on bits in int #1429

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion persistent/test/Database/Persist/THSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..))
Expand Down Expand Up @@ -221,7 +222,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
Expand Down