1{-# language BlockArguments #-}
2{-# language OverloadedStrings #-}
7import Control.Exception ( bracket, throwIO )
8import Data.Foldable ( traverse_ )
9import System.Environment ( lookupEnv, setEnv )
12import System.Environment.Compat ( unsetEnv )
15import Data.ByteString.Char8 ( unpack )
18import Test.DocTest ( doctest )
21import Hasql.Connection ( acquire, release )
22import Hasql.Session ( run, sql )
25import Build_doctests ( flags, module_sources, pkgs )
28import Database.Postgres.Temp ( toConnectionString, verboseConfig, with, withConfig )
33 nixGhcLibdir <- lookupEnv "NIX_GHC_LIBDIR"
34 unsetEnv "GHC_ENVIRONMENT"
35 either throwIO return =<< with \db -> do
36 setEnv "TEST_DATABASE_URL" (unpack (toConnectionString db))
37 bracket (either (error . show) return =<< acquire (toConnectionString db)) release \conn -> do
39 sql "create table author ( author_id serial primary key, name text not null, url text )"
40 sql "create table project ( author_id int not null references author (author_id), name text not null )"
42 sql "insert into author ( name, url ) values ( 'Ollie', 'https://ocharles.org.uk' )"
43 sql "insert into author ( name, url ) values ( 'Bryan O''Sullivan', null )"
44 sql "insert into author ( name, url ) values ( 'Emily Pillmore', 'https://cohomolo.gy' )"
45 sql "insert into project ( author_id, name ) values ( 1, 'rel8' )"
46 sql "insert into project ( author_id, name ) values ( 2, 'aeson' )"
47 sql "insert into project ( author_id, name ) values ( 2, 'text' )"
49 doctest (args nixGhcLibdir)
53 flags ++ pkgs ++ foldMap (\x -> ["-package-db" <> x <> "/package.conf.d"]) nixGhcLibdir ++ module_sources
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list