packages feed

persistent-test 2.0.3.2 → 2.0.3.3

raw patch · 7 files changed

+43/−13 lines, 7 files

Files

+ ChangeLog.md view
@@ -0,0 +1,13 @@+## Unreleased changes++## 2.0.3.3++* Fix RawSqlTest, which could fail non-deterministically for Postgres [#1139](https://github.com/yesodweb/persistent/pull/1139)++## 2.0.3.2++* Remove unnecessary deriving of Typeable [#1114](https://github.com/yesodweb/persistent/pull/1114)++## 2.0.3.1++* Compatibility with latest persistent-template for test suite [#1002](https://github.com/yesodweb/persistent/pull/1002/files)
persistent-test.cabal view
@@ -1,5 +1,5 @@ name:            persistent-test-version:         2.0.3.2+version:         2.0.3.3 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>@@ -12,6 +12,7 @@ build-type:      Simple homepage:        http://www.yesodweb.com/book/persistent bug-reports:     https://github.com/yesodweb/persistent/issues+extra-source-files: ChangeLog.md  library     exposed-modules: CompositeTest
src/Init.hs view
@@ -93,7 +93,7 @@ asIO :: IO a -> IO a asIO a = a -(@/=), (@==), (==@) :: (Eq a, Show a, MonadIO m) => a -> a -> m ()+(@/=), (@==), (==@) :: (HasCallStack, Eq a, Show a, MonadIO m) => a -> a -> m () infix 1 @/= --, /=@ actual @/= expected = liftIO $ assertNotEqual "" expected actual @@ -106,7 +106,7 @@ -}  -assertNotEqual :: (Eq a, Show a) => String -> a -> a -> Assertion+assertNotEqual :: (Eq a, Show a, HasCallStack) => String -> a -> a -> Assertion assertNotEqual preface expected actual =   unless (actual /= expected) (assertFailure msg)   where msg = (if null preface then "" else preface ++ "\n") ++
src/MigrationTest.hs view
@@ -17,6 +17,10 @@ Source     field3 Int     field4 TargetId++CustomSqlId+    pk      Int   sql=id+    Primary pk |]  share [mkPersist sqlSettings, mkMigrate "migrationAddCol", mkDeleteCascade sqlSettings] [persistLowerCase|@@ -38,6 +42,7 @@       again <- getMigration migrationMigrate       liftIO $ again @?= []     it "really is idempotent" $ runDb $ do+      runMigrationSilent migrationMigrate       runMigrationSilent migrationMigrate       again <- getMigration migrationMigrate       liftIO $ again @?= []
src/PersistentTestModels.hs view
@@ -6,6 +6,7 @@  import Data.Aeson +import Data.Proxy import Test.QuickCheck import Database.Persist.Sql import Database.Persist.TH@@ -110,6 +111,7 @@    MutB     mutA    MutAId+ |]  deriving instance Show (BackendKey backend) => Show (PetGeneric backend)@@ -118,11 +120,11 @@ deriving instance Show (BackendKey backend) => Show (RelationshipGeneric backend) deriving instance Eq (BackendKey backend) => Eq (RelationshipGeneric backend) -share [mkPersist persistSettings { +share [mkPersist persistSettings {           mpsPrefixFields = False         , mpsFieldLabelModifier = \_ _ -> "" -- this field is ignored when mpsPrefixFields == False         , mpsConstraintLabelModifier = \_ _ -> "" -- this field is ignored when mpsPrefixFields == False-        , mpsGeneric = True +        , mpsGeneric = True         }       , mkMigrate "noPrefixMigrate"       ] [persistLowerCase|@@ -138,7 +140,7 @@  |] -share [mkPersist sqlSettings] [persistLowerCase|+share [mkMigrate "testNonGenericMigrate", mkPersist sqlSettings] [persistLowerCase| JsonEncoding json     name Text     age  Int@@ -165,7 +167,7 @@ deriving instance Show (BackendKey backend) => Show (NoPrefix2Generic backend) deriving instance Eq (BackendKey backend) => Eq (NoPrefix2Generic backend) -share [mkPersist persistSettings { +share [mkPersist persistSettings {           mpsFieldLabelModifier = \entity field -> case entity of             "CustomPrefix1" -> append "_cp1" field             "CustomPrefix2" -> append "_cp2" field@@ -219,9 +221,11 @@     keyFromValues = fmap RFOKey . fromPersistValue . head     keyToValues   = (:[]) . toPersistValue . unRFOKey -    entityDef = revFields . entityDef . liftM unRFO-        where-          revFields ed = ed { entityFields = reverse (entityFields ed) }+    entityDef = revFields . entityDef . unRfoProxy+      where+        unRfoProxy :: proxy (ReverseFieldOrder a) -> Proxy a+        unRfoProxy _ = Proxy+        revFields ed = ed { entityFields = reverse (entityFields ed) }      toPersistFields = reverse . toPersistFields . unRFO     newtype EntityField (ReverseFieldOrder a) b = EFRFO {unEFRFO :: EntityField a b}
src/RawSqlTest.hs view
@@ -37,13 +37,15 @@         escape <- getEscape         person <- getTableName (error "rawSql Person" :: Person)         name   <- getFieldName PersonName+        pet <- getTableName (error "rawSql Pet" :: Pet)+        petName   <- getFieldName PetName         let query = T.concat [ "SELECT ??, ?? "                              , "FROM ", person                              , ", ", escape "Pet"                              , " WHERE ", person, ".", escape "age", " >= ? "                              , "AND ", escape "Pet", ".", escape "ownerId", " = "                                      , person, ".", escape "id"-                             , " ORDER BY ", person, ".", name+                             , " ORDER BY ", person, ".", name, ", ", pet, ".", petName                              ]         ret <- rawSql query [PersistInt64 20]         liftIO $ ret @?= [ (Entity p1k p1, Entity a1k a1)@@ -114,7 +116,8 @@                              , "LEFT OUTER JOIN ", pet                              , " ON ", person, ".", escape "id"                              , " = ", pet, ".", escape "ownerId"-                             , " ORDER BY ", person, ".", escape "name"]+                             , " ORDER BY ", person, ".", escape "name"+                             , ", ", pet, ".", escape "id" ]             person = escape "Person"             pet    = escape "Pet"         ret <- rawSql query []
src/RenameTest.hs view
@@ -19,7 +19,11 @@     deriving Eq Show  IdTable-    Id   Day default=CURRENT_DATE+    -- this used to have a default=CURRENT_DATE, but the test that uses it+    -- specifies that there is no default on this column. the default is+    -- failing MySQL and sqlite tests since they don't have shared overlap on+    -- an appropriate default for a date.+    Id   Day     name Text     -- This was added to test the ability to break a cycle     -- getting rid of the Maybe should be a compilation failure