persistent-test 2.0.3.5 → 2.12.0.0
raw patch · 6 files changed
+30/−14 lines, 6 filesdep −persistent-templatedep ~persistent
Dependencies removed: persistent-template
Dependency ranges changed: persistent
Files
- ChangeLog.md +4/−0
- persistent-test.cabal +2/−3
- src/ForeignKey.hs +14/−1
- src/RawSqlTest.hs +1/−1
- src/RenameTest.hs +1/−1
- src/TreeTest.hs +8/−8
ChangeLog.md view
@@ -1,5 +1,9 @@ ## Unreleased changes +## 2.12.0.0++* Decomposed `HaskellName` into `ConstraintNameHS`, `EntityNameHS`, `FieldNameHS`. Decomposed `DBName` into `ConstraintNameDB`, `EntityNameDB`, `FieldNameDB` respectively. [#1174](https://github.com/yesodweb/persistent/pull/1174)+ ## 2.0.3.5 * Tighter version bounds on `persistent` and `persistent-template`.
persistent-test.cabal view
@@ -1,5 +1,5 @@ name: persistent-test-version: 2.0.3.5+version: 2.12.0.0 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -60,8 +60,7 @@ build-depends: base >= 4.9 && < 5- , persistent >= 2.11 && < 2.12- , persistent-template >= 2.9 && < 2.10+ , persistent >= 2.12 && < 2.13 , aeson >= 1.0 , blaze-html >= 0.9 , bytestring >= 0.10
src/ForeignKey.hs view
@@ -92,6 +92,11 @@ previous Chain2Id Maybe noreference Foreign Chain2 OnDeleteCascade fkChain previous References Id deriving Show Eq++Chain3+ name Int+ previous Chain3Id Maybe OnDeleteCascade+ deriving Show Eq |] specsWith :: (MonadIO m, MonadFail m) => RunDb SqlBackend m -> Spec@@ -180,12 +185,20 @@ cs <- selectList [] [] let expected = [] :: [Entity Chain2] cs @== expected+ it "deletes cascades with field self reference to the whole chain" $ runDb $ do+ k1 <- insert $ Chain3 1 Nothing+ k2 <- insert $ Chain3 2 (Just k1)+ insert_ $ Chain3 3 (Just k2)+ delete k1+ cs <- selectList [] []+ let expected = [] :: [Entity Chain3]+ cs @== expected describe "EntityDef" $ do let ed = entityDef (Proxy @SimpleCascadeChild) isRefCol =- (HaskellName "ref" ==) . fieldHaskell+ (FieldNameHS "ref" ==) . fieldHaskell expected = FieldCascade { fcOnUpdate = Nothing , fcOnDelete = Just Cascade
src/RawSqlTest.hs view
@@ -141,7 +141,7 @@ liftIO $ ret @?= [(Single (1::Int), Single (2::Int), Single (3::Int), Single (4::Int), Single (5::Int), Single (6::Int), Single (7::Int), Single (8::Int), Single (9::Int), Single (10::Int), Single (11::Int), Single (12::Int), Single (13::Int), Single (14::Int), Single (15::Int))] getEscape :: MonadReader SqlBackend m => m (Text -> Text)-getEscape = asks ((. DBName) . connEscapeName)+getEscape = asks connEscapeRawName caseCommitRollback :: Runner SqlBackend m => RunDb SqlBackend m -> Assertion caseCommitRollback runDb = runDb $ do
src/RenameTest.hs view
@@ -77,7 +77,7 @@ it "LowerCaseTable has the right sql name" $ do fieldDB (entityId (entityDef (Proxy @LowerCaseTable))) `shouldBe`- DBName "my_id"+ FieldNameDB "my_id" it "user specified id, insertKey, no default=" $ runDb $ do let rec2 = IdTable "Foo2" Nothing
src/TreeTest.hs view
@@ -43,27 +43,27 @@ describe "entityDef" $ do let EntityDef{..} = entityDef (Proxy :: Proxy Tree) it "has the right haskell name" $ do- entityHaskell `shouldBe` HaskellName "Tree"+ entityHaskell `shouldBe` EntityNameHS "Tree" it "has the right DB name" $ do- entityDB `shouldBe` DBName "trees"+ entityDB `shouldBe` EntityNameDB "trees" describe "foreign ref" $ do let [ForeignDef{..}] = entityForeigns (entityDef (Proxy :: Proxy Tree)) it "has the right haskell name" $ do foreignRefTableHaskell `shouldBe`- HaskellName "Tree"+ EntityNameHS "Tree" it "has the right db name" $ do foreignRefTableDBName `shouldBe`- DBName "trees"+ EntityNameDB "trees" it "has the right constraint name" $ do foreignConstraintNameHaskell `shouldBe`- HaskellName "fkparent"+ ConstraintNameHS "fkparent" it "has the right DB constraint name" $ do foreignConstraintNameDBName `shouldBe`- DBName "treesfkparent"+ ConstraintNameDB "treesfkparent" it "has the right fields" $ do foreignFields `shouldBe`- [ ( (HaskellName "parent", DBName "parent")- , (HaskellName "name", DBName "name")+ [ ( (FieldNameHS "parent", FieldNameDB "parent")+ , (FieldNameHS "name", FieldNameDB "name") ) ]