From f6486ddc716d83e426d397db29937fc71a6ec73b Mon Sep 17 00:00:00 2001 From: vrom911 Date: Mon, 8 Jul 2019 14:54:31 +0800 Subject: [PATCH] [#2] Add doctest --- postgresql-simple-named.cabal | 11 +++++++++++ src/PgNamed.hs | 2 +- test/Doctest.hs | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/Doctest.hs diff --git a/postgresql-simple-named.cabal b/postgresql-simple-named.cabal index 3c3414b..df303d6 100644 --- a/postgresql-simple-named.cabal +++ b/postgresql-simple-named.cabal @@ -81,3 +81,14 @@ test-suite postgresql-simple-named-test build-depends: postgresql-simple-named ghc-options: -threaded -rtsopts -with-rtsopts=-N + +test-suite postgresql-simple-named-doctest + import: common-options + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Doctest.hs + + build-depends: doctest + , Glob + + ghc-options: -threaded diff --git a/src/PgNamed.hs b/src/PgNamed.hs index 390bcee..adaf18e 100644 --- a/src/PgNamed.hs +++ b/src/PgNamed.hs @@ -146,7 +146,7 @@ namesToRow names params = traverse magicLookup names {- | Operator to create 'NamedParam's. >>> "foo" =? (1 :: Int) -NamedParam {namedParamName = "foo", namedParamParam = 1} +NamedParam {namedParamName = "foo", namedParamParam = Plain "1"} So it can be used in creating the list of the named arguments: diff --git a/test/Doctest.hs b/test/Doctest.hs new file mode 100644 index 0000000..b51fa67 --- /dev/null +++ b/test/Doctest.hs @@ -0,0 +1,16 @@ +module Main (main) where + +import System.FilePath.Glob (glob) +import Test.DocTest (doctest) + +main :: IO () +main = do + sourceFiles <- glob "src/**/*.hs" + doctest + $ "-XConstraintKinds" + : "-XGeneralizedNewtypeDeriving" + : "-XLambdaCase" + : "-XOverloadedStrings" + : "-XRecordWildCards" + : "-XScopedTypeVariables" + : sourceFiles