summaryrefslogtreecommitdiff
path: root/tests/examples
diff options
context:
space:
mode:
authorAlanZimmerman <>2019-08-28 18:45:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-08-28 18:45:00 (GMT)
commit72a92d78f15b002ee468a5d56182518a3d4f9b3e (patch)
tree1d4d4dd9139124049dbbaa917ae268fa4c5c2719 /tests/examples
parent8b58806da36a60014c8441056e950947ed633c2c (diff)
version 0.6.2HEAD0.6.2master
Diffstat (limited to 'tests/examples')
-rwxr-xr-xtests/examples/ghc88/PersistUniqueTest.hs45
1 files changed, 0 insertions, 45 deletions
diff --git a/tests/examples/ghc88/PersistUniqueTest.hs b/tests/examples/ghc88/PersistUniqueTest.hs
deleted file mode 100755
index 9a60a6d..0000000
--- a/tests/examples/ghc88/PersistUniqueTest.hs
+++ /dev/null
@@ -1,45 +0,0 @@
-{-# LANGUAGE QuasiQuotes, TemplateHaskell, CPP, GADTs, TypeFamilies, OverloadedStrings, FlexibleContexts, EmptyDataDecls, FlexibleInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses #-}
-module PersistUniqueTest where
-
-import Init
-
--- mpsGeneric = False is due to a bug or at least lack of a feature in mkKeyTypeDec TH.hs
-#if WITH_NOSQL
-mkPersist persistSettings { mpsGeneric = False } [persistUpperCase|
-#else
-share [mkPersist persistSettings { mpsGeneric = False }, mkMigrate "migration"] [persistLowerCase|
-#endif
- Fo
- foo Int
- bar Int
- Primary foo
- UniqueBar bar
- deriving Eq Show
-|]
-#ifdef WITH_NOSQL
-cleanDB :: (MonadIO m, PersistQuery backend, PersistEntityBackend Fo ~ backend) => ReaderT backend m ()
-cleanDB = do
- deleteWhere ([] :: [Filter Fo])
-
-db :: Action IO () -> Assertion
-db = db' cleanDB
-#endif
-
-specs :: Spec
-specs = describe "custom primary key" $ do
-#ifdef WITH_NOSQL
- return ()
-#else
- it "getBy" $ db $ do
- let b = 5
- k <- insert $ Fo 3 b
- Just vk <- get k
- Just vu <- getBy (UniqueBar b)
- vu @== Entity k vk
- it "insertUniqueEntity" $ db $ do
- let fo = Fo 3 5
- Just (Entity _ insertedFoValue) <- insertUniqueEntity fo
- Nothing <- insertUniqueEntity fo
- fo @== insertedFoValue
-#endif
-