diff --git a/postgrest.cabal b/postgrest.cabal index b2fcc58c4..2f365c6d0 100644 --- a/postgrest.cabal +++ b/postgrest.cabal @@ -17,8 +17,7 @@ executable postgrest main-is: Main.hs ghc-options: -Wall -W -O2 default-language: Haskell2010 - default-extensions: OverloadedStrings, ScopedTypeVariables - other-extensions: QuasiQuotes + default-extensions: OverloadedStrings, ScopedTypeVariables, QuasiQuotes build-depends: base >=4.6 && <5 , hasql == 0.7.*, hasql-backend , hasql-postgres == 0.10.* @@ -57,8 +56,7 @@ executable postgrest Test-Suite spec Type: exitcode-stdio-1.0 Default-Language: Haskell2010 - default-extensions: OverloadedStrings, ScopedTypeVariables - other-extensions: QuasiQuotes + default-extensions: OverloadedStrings, ScopedTypeVariables, QuasiQuotes Hs-Source-Dirs: test, src ghc-options: -Wall -W -Werror Main-Is: Main.hs diff --git a/test/Feature/AuthSpec.hs b/test/Feature/AuthSpec.hs index 4c5f208a0..4af66137c 100644 --- a/test/Feature/AuthSpec.hs +++ b/test/Feature/AuthSpec.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE QuasiQuotes #-} module Feature.AuthSpec where -- {{{ Imports diff --git a/test/Feature/InsertSpec.hs b/test/Feature/InsertSpec.hs index 4c50c023d..4196fcb00 100644 --- a/test/Feature/InsertSpec.hs +++ b/test/Feature/InsertSpec.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE QuasiQuotes #-} module Feature.InsertSpec where import Test.Hspec diff --git a/test/Feature/QuerySpec.hs b/test/Feature/QuerySpec.hs index a54ab374c..9a008df28 100644 --- a/test/Feature/QuerySpec.hs +++ b/test/Feature/QuerySpec.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE QuasiQuotes, NoMonomorphismRestriction #-} module Feature.QuerySpec where import Test.Hspec @@ -12,19 +11,22 @@ import Data.Text(Text) import SpecHelper testSet :: IO () -testSet = do { - clearTable "items" >> clearTable "no_pk"; - createItems 15; - pool :: H.Pool H.Postgres <- H.acquirePool pgSettings testPoolOpts; +testSet = do + clearTable "items" >> clearTable "no_pk" + createItems 15 + pool <- H.acquirePool pgSettings testPoolOpts void . liftIO $ H.session pool $ H.tx Nothing $ do - H.unitEx $ - ([H.stmt|insert into "1".no_pk (a, b) values (?,?), (?,?), (?,?), (?,?)|] - :: Text->Text->Text->Text->Text->Text->Text->Text-> H.Stmt H.Postgres) - "lick" "Fun" - "trick" "funky" - "barb" "foo" - "BARD" "FOOD" -} + mapM_ H.unitEx $ map (uncurry insertNoPk) [ + ("lick", "Fun") + , ("trick", "funky") + , ("barb", "foo") + , ("BARD", "FOOD") + ] + + where + insertNoPk :: Text -> Text -> H.Stmt H.Postgres + insertNoPk = [H.stmt|insert into "1".no_pk (a, b) values (?,?)|] + spec :: Spec spec = beforeAll testSet . afterAll_ (clearTable "items") . around withApp $ do describe "Querying a nonexistent table" $ diff --git a/test/Feature/StructureSpec.hs b/test/Feature/StructureSpec.hs index 98adf05c6..a9001dcd6 100644 --- a/test/Feature/StructureSpec.hs +++ b/test/Feature/StructureSpec.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE OverloadedStrings, QuasiQuotes #-} module Feature.StructureSpec where import Test.Hspec hiding (pendingWith) diff --git a/test/Main.hs b/test/Main.hs index ccd6171c1..ab3a1f17f 100644 --- a/test/Main.hs +++ b/test/Main.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE QuasiQuotes #-} module Main where import Test.Hspec diff --git a/test/SpecHelper.hs b/test/SpecHelper.hs index 1de74ea76..e12c7f76b 100644 --- a/test/SpecHelper.hs +++ b/test/SpecHelper.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE QuasiQuotes, OverloadedStrings #-} - module SpecHelper where import Network.Wai