persistent 2.13.1.0 → 2.13.1.1
raw patch · 5 files changed
+75/−7 lines, 5 files
Files
- ChangeLog.md +6/−0
- Database/Persist/Quasi/Internal.hs +1/−1
- persistent.cabal +2/−1
- test/Database/Persist/TH/CommentSpec.hs +64/−0
- test/Database/Persist/THSpec.hs +2/−5
ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for persistent +## 2.13.1.1++* [#1294](https://github.com/yesodweb/persistent/pull/1294)+ * Fix an issue where documentation comments on fields are in reverse line+ order.+ ## 2.13.1.0 * [#1264](https://github.com/yesodweb/persistent/pull/1264)
Database/Persist/Quasi/Internal.hs view
@@ -789,7 +789,7 @@ Just (DocComment comment) -> (acc, comment : comments) _ ->- case (setFieldComments comments <$> takeColsEx ps (tokenText <$> x)) of+ case (setFieldComments (reverse comments) <$> takeColsEx ps (tokenText <$> x)) of Just sm -> (sm : acc, []) Nothing ->
persistent.cabal view
@@ -1,5 +1,5 @@ name: persistent-version: 2.13.1.0+version: 2.13.1.1 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -167,6 +167,7 @@ Database.Persist.TH.PersistWith.Model Database.Persist.TH.PersistWith.Model2 Database.Persist.TH.PersistWithSpec+ Database.Persist.TH.CommentSpec Database.Persist.TH.ImplicitIdColSpec Database.Persist.TH.JsonEncodingSpec Database.Persist.TH.KindEntitiesSpec
+ test/Database/Persist/TH/CommentSpec.hs view
@@ -0,0 +1,64 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE DerivingStrategies #-}+{-# LANGUAGE ExistentialQuantification #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE QuasiQuotes #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeApplications #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE UndecidableInstances #-}++module Database.Persist.TH.CommentSpec where++import TemplateTestImports++import Database.Persist.EntityDef.Internal (EntityDef(..))+import Database.Persist.FieldDef.Internal (FieldDef(..))++mkPersist sqlSettings [persistLowerCase|++-- | Doc comments work.+-- | Has multiple lines.+CommentModel+ -- | First line of comment on column.+ -- | Second line of comment on column.+ name String++ deriving Eq Show++|]++pass :: IO ()+pass = pure ()++asIO :: IO a -> IO a+asIO = id++spec :: Spec+spec = describe "CommentSpec" $ do+ let+ ed =+ entityDef (Proxy @CommentModel)+ it "has entity comments" $ do+ entityComments ed+ `shouldBe` do+ Just $ mconcat+ [ "Doc comments work.\n"+ , "Has multiple lines.\n"+ ]++ describe "fieldComments" $ do+ let+ [nameComments] =+ map fieldComments $ entityFields ed+ it "has the right name comments" $ do+ nameComments+ `shouldBe` do+ Just $ mconcat+ [ "First line of comment on column.\n"+ , "Second line of comment on column.\n"+ ]
test/Database/Persist/THSpec.hs view
@@ -60,11 +60,7 @@ import qualified Database.Persist.TH.SharedPrimaryKeyImportedSpec as SharedPrimaryKeyImportedSpec import qualified Database.Persist.TH.SharedPrimaryKeySpec as SharedPrimaryKeySpec import qualified Database.Persist.TH.ToFromPersistValuesSpec as ToFromPersistValuesSpec-import qualified Database.Persist.TH.KindEntitiesSpec as KindEntitiesSpec-import qualified Database.Persist.TH.OverloadedLabelSpec as OverloadedLabelSpec-import qualified Database.Persist.TH.SharedPrimaryKeyImportedSpec as SharedPrimaryKeyImportedSpec-import qualified Database.Persist.TH.SharedPrimaryKeySpec as SharedPrimaryKeySpec-import qualified Database.Persist.TH.ToFromPersistValuesSpec as ToFromPersistValuesSpec+import qualified Database.Persist.TH.CommentSpec as CommentSpec -- test to ensure we can have types ending in Id that don't trash the TH -- machinery@@ -189,6 +185,7 @@ ForeignRefSpec.spec ToFromPersistValuesSpec.spec JsonEncodingSpec.spec+ CommentSpec.spec describe "TestDefaultKeyCol" $ do let EntityIdField FieldDef{..} = entityId (entityDef (Proxy @TestDefaultKeyCol))