commit
8c4b8e5094
119
.azure/azure-linux-template.yml
Normal file
119
.azure/azure-linux-template.yml
Normal file
@ -0,0 +1,119 @@
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: ${{ parameters.vmImage }}
|
||||
strategy:
|
||||
matrix:
|
||||
stack-def:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
stack-lts-9:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack-lts-9.yaml
|
||||
ARGS: "--resolver lts-9"
|
||||
stack-lts-11:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-11"
|
||||
stack-lts-12:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-12"
|
||||
stack-lts-13:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-13"
|
||||
stack-persistent-2-9:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack-persistent-2-9.yaml
|
||||
ARGS: ""
|
||||
stack-persistent-2-10:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack-persistent-2-10.yaml
|
||||
ARGS: ""
|
||||
cabal-8.0.2:
|
||||
BUILD: cabal
|
||||
GHCVER: 8.0.2
|
||||
CABALVER: 1.24
|
||||
cabal-8.2.2:
|
||||
BUILD: cabal
|
||||
GHCVER: 8.2.2
|
||||
CABALVER: 2.0
|
||||
cabal-8.4.4:
|
||||
BUILD: cabal
|
||||
GHCVER: 8.4.4
|
||||
CABALVER: 2.2
|
||||
cabal-8.6.5:
|
||||
BUILD: cabal
|
||||
GHCVER: 8.6.5
|
||||
CABALVER: 2.4
|
||||
nightly:
|
||||
BUILD: stack
|
||||
ARGS: "--resolver nightly"
|
||||
pedantic:
|
||||
BUILD: pedantic
|
||||
STACK_YAML: stack.yaml
|
||||
maxParallel: 6
|
||||
steps:
|
||||
- script: |
|
||||
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
|
||||
mkdir -p ~/.local/bin
|
||||
curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
|
||||
case "$BUILD" in
|
||||
cabal)
|
||||
sudo add-apt-repository -y ppa:hvr/ghc
|
||||
sudo apt-get update
|
||||
sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER
|
||||
# See note here: https://github.com/haskell-CI/haskell-ci#alex--happy-with-ghc--78
|
||||
if [ "$GHCVER" = "head" ] || [ "${GHCVER%.*}" = "7.8" ] || [ "${GHCVER%.*}" = "7.10" ]; then
|
||||
sudo apt-get install happy-1.19.4 alex-3.1.3
|
||||
export PATH=/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:$PATH
|
||||
else
|
||||
sudo apt-get install happy alex
|
||||
fi
|
||||
export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH
|
||||
cabal --version
|
||||
cabal update
|
||||
PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
|
||||
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
|
||||
;;
|
||||
*)
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
stack --install-ghc $ARGS test --bench --only-dependencies
|
||||
;;
|
||||
esac
|
||||
set -ex
|
||||
case "$BUILD" in
|
||||
cabal)
|
||||
cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
|
||||
|
||||
ORIGDIR=$(pwd)
|
||||
for dir in $PACKAGES
|
||||
do
|
||||
cd $dir
|
||||
cabal check || [ "$CABALVER" == "1.16" ]
|
||||
cabal sdist
|
||||
PKGVER=$(cabal info . | awk '{print $2;exit}')
|
||||
SRC_TGZ=$PKGVER.tar.gz
|
||||
cd dist
|
||||
tar zxfv "$SRC_TGZ"
|
||||
cd "$PKGVER"
|
||||
cabal configure --enable-tests --ghc-options -O0
|
||||
cabal build
|
||||
if [ "$CABALVER" = "1.16" ] || [ "$CABALVER" = "1.18" ]; then
|
||||
cabal test
|
||||
else
|
||||
cabal test --show-details=streaming
|
||||
fi
|
||||
cd $ORIGDIR
|
||||
done
|
||||
;;
|
||||
*)
|
||||
stack $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
|
||||
;;
|
||||
esac
|
||||
set +ex
|
||||
env:
|
||||
OS_NAME: ${{ parameters.os }}
|
||||
displayName: 'Installation ${{parameters.os}} & Test'
|
||||
43
.azure/azure-osx-template.yml
Normal file
43
.azure/azure-osx-template.yml
Normal file
@ -0,0 +1,43 @@
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: ${{ parameters.vmImage }}
|
||||
strategy:
|
||||
matrix:
|
||||
stack-lts-9:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack-lts-9.yaml
|
||||
ARGS: "--resolver lts-9"
|
||||
stack-lts-11:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-11"
|
||||
stack-lts-12:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-12"
|
||||
stack-lts-13:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-13"
|
||||
stack-persistent-2-9:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack-persistent-2-9.yaml
|
||||
ARGS: ""
|
||||
stack-persistent-2-10:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack-persistent-2-10.yaml
|
||||
ARGS: ""
|
||||
maxParallel: 3
|
||||
steps:
|
||||
- script: |
|
||||
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
|
||||
mkdir -p ~/.local/bin
|
||||
curl -skL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin;
|
||||
export PATH=$HOME/.local/bin:$PATH
|
||||
stack --install-ghc $ARGS test --bench --only-dependencies
|
||||
stack $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
|
||||
env:
|
||||
OS_NAME: ${{ parameters.os }}
|
||||
displayName: 'Installation ${{parameters.os}} & Test'
|
||||
30
.azure/azure-pipelines.yml
Normal file
30
.azure/azure-pipelines.yml
Normal file
@ -0,0 +1,30 @@
|
||||
# This is the complex Azure configuration, which is intended for use
|
||||
# on open source libraries which need compatibility across multiple GHC
|
||||
# versions, must work with cabal-install, and should be
|
||||
# cross-platform. For more information and other options, see:
|
||||
#
|
||||
# https://docs.haskellstack.org/en/stable/azure_ci/
|
||||
#
|
||||
# Copy these contents into the root directory of your Github project in a file
|
||||
# named azure-pipelines.yml
|
||||
#
|
||||
# For better organization, you split various jobs into seprate parts
|
||||
# and each of them are controlled via individual file.
|
||||
jobs:
|
||||
- template: azure-linux-template.yml
|
||||
parameters:
|
||||
name: Linux
|
||||
vmImage: ubuntu-16.04
|
||||
os: linux
|
||||
|
||||
- template: azure-osx-template.yml
|
||||
parameters:
|
||||
name: macOS
|
||||
vmImage: macOS-10.13
|
||||
os: osx
|
||||
|
||||
- template: azure-windows-template.yml
|
||||
parameters:
|
||||
name: Windows
|
||||
vmImage: vs2017-win2016
|
||||
os: windows
|
||||
31
.azure/azure-windows-template.yml
Normal file
31
.azure/azure-windows-template.yml
Normal file
@ -0,0 +1,31 @@
|
||||
jobs:
|
||||
- job: ${{ parameters.name }}
|
||||
timeoutInMinutes: 120
|
||||
pool:
|
||||
vmImage: ${{ parameters.vmImage }}
|
||||
strategy:
|
||||
matrix:
|
||||
stack-lts-11:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-11"
|
||||
stack-lts-12:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-12"
|
||||
stack-lts-13:
|
||||
BUILD: stack
|
||||
STACK_YAML: stack.yaml
|
||||
ARGS: "--resolver lts-13"
|
||||
maxParallel: 3
|
||||
steps:
|
||||
- bash: |
|
||||
export STACK_ROOT="$(Build.SourcesDirectory)"/.stack-root;
|
||||
curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip
|
||||
unzip -o /usr/bin/stack.zip -d /usr/bin/
|
||||
stack setup $ARGS > /dev/null
|
||||
stack --install-ghc $ARGS test --bench --only-dependencies
|
||||
stack $ARGS test --bench --no-run-benchmarks
|
||||
env:
|
||||
OS_NAME: ${{ parameters.os }}
|
||||
displayName: 'Installation ${{parameters.os}} & Test'
|
||||
212
.travis.yml
212
.travis.yml
@ -1,212 +0,0 @@
|
||||
# This is the complex Travis configuration, which is intended for use
|
||||
# on open source libraries which need compatibility across multiple GHC
|
||||
# versions, must work with cabal-install, and should be
|
||||
# cross-platform. For more information and other options, see:
|
||||
#
|
||||
# https://docs.haskellstack.org/en/stable/travis_ci/
|
||||
#
|
||||
# Copy these contents into the root directory of your Github project in a file
|
||||
# named .travis.yml
|
||||
|
||||
# Use new container infrastructure to enable caching
|
||||
sudo: false
|
||||
|
||||
# Do not choose a language; we provide our own build tools.
|
||||
language: generic
|
||||
|
||||
# Caching so the next build will be fast too.
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.ghc
|
||||
- $HOME/.cabal
|
||||
- $HOME/.stack
|
||||
|
||||
# The different configurations we want to test. We have BUILD=cabal which uses
|
||||
# cabal-install, and BUILD=stack which uses Stack. More documentation on each
|
||||
# of those below.
|
||||
#
|
||||
# We set the compiler values here to tell Travis to use a different
|
||||
# cache file per set of arguments.
|
||||
#
|
||||
# If you need to have different apt packages for each combination in the
|
||||
# matrix, you can use a line such as:
|
||||
# addons: {apt: {packages: [libfcgi-dev,libgmp-dev]}}
|
||||
matrix:
|
||||
include:
|
||||
# We grab the appropriate GHC and cabal-install versions from hvr's PPA. See:
|
||||
# https://github.com/hvr/multi-ghc-travis
|
||||
- env: BUILD=cabal GHCVER=8.0.2 CABALVER=1.24 HAPPYVER=1.19.5 ALEXVER=3.1.7
|
||||
compiler: ": #GHC 8.0.2"
|
||||
addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
|
||||
- env: BUILD=cabal GHCVER=8.2.2 CABALVER=2.0 HAPPYVER=1.19.5 ALEXVER=3.1.7
|
||||
compiler: ": #GHC 8.2.2"
|
||||
addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
|
||||
- env: BUILD=cabal GHCVER=8.4.4 CABALVER=2.2 HAPPYVER=1.19.5 ALEXVER=3.1.7
|
||||
compiler: ": #GHC 8.4.4"
|
||||
addons: {apt: {packages: [cabal-install-2.2,ghc-8.4.4,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
|
||||
- env: BUILD=cabal GHCVER=8.6.3 CABALVER=2.4 HAPPYVER=1.19.5 ALEXVER=3.1.7
|
||||
compiler: ": #GHC 8.6.3"
|
||||
addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.3,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
|
||||
|
||||
# Build with the newest GHC and cabal-install. This is an accepted failure,
|
||||
# see below.
|
||||
- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
|
||||
compiler: ": #GHC HEAD"
|
||||
addons: {apt: {packages: [cabal-install-head,ghc-head,happy-1.19.5,alex-3.1.7], sources: [hvr-ghc]}}
|
||||
|
||||
# The Stack builds. We can pass in arbitrary Stack arguments via the ARGS
|
||||
# variable, such as using --stack-yaml to point to a different file.
|
||||
- env: BUILD=stack ARGS=""
|
||||
compiler: ": #stack default"
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
|
||||
- env: BUILD=stack ARGS="--stack-yaml stack-lts-9.yaml --resolver lts-9"
|
||||
compiler: ": #stack 8.0.2"
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
|
||||
- env: BUILD=stack ARGS="--resolver lts-11"
|
||||
compiler: ": #stack 8.2.2"
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
|
||||
- env: BUILD=stack ARGS="--resolver lts-12"
|
||||
compiler: ": #stack 8.4.4"
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
|
||||
- env: BUILD=stack ARGS="--resolver lts-13"
|
||||
compiler: ": #stack 8.6.3"
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
|
||||
- env: BUILD=stack ARGS="--stack-yaml stack-persistent-2-9.yaml"
|
||||
compiler: ": #stack/persistent 2.9"
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
|
||||
- env: BUILD=stack ARGS="--stack-yaml stack-persistent-2-10.yaml"
|
||||
compiler: ": #stack/persistent 2.10"
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
|
||||
# Nightly builds are allowed to fail
|
||||
- env: BUILD=stack ARGS="--resolver nightly"
|
||||
compiler: ": #stack nightly"
|
||||
addons: {apt: {packages: [libgmp-dev]}}
|
||||
|
||||
# Build on macOS in addition to Linux
|
||||
- env: BUILD=stack ARGS=""
|
||||
compiler: ": #stack default osx"
|
||||
os: osx
|
||||
|
||||
- env: BUILD=stack ARGS="--stack-yaml stack-lts-9.yaml --resolver lts-9"
|
||||
compiler: ": #stack 8.0.2 osx"
|
||||
os: osx
|
||||
|
||||
- env: BUILD=stack ARGS="--resolver lts-11"
|
||||
compiler: ": #stack 8.2.2 osx"
|
||||
os: osx
|
||||
|
||||
- env: BUILD=stack ARGS="--resolver lts-12"
|
||||
compiler: ": #stack 8.4.4 osx"
|
||||
os: osx
|
||||
|
||||
- env: BUILD=stack ARGS="--resolver lts-13"
|
||||
compiler: ": #stack 8.6.3 osx"
|
||||
os: osx
|
||||
|
||||
- env: BUILD=stack ARGS="--stack-yaml stack-persistent-2-9.yaml"
|
||||
compiler: ": #stack/persistent 2.9"
|
||||
os: osx
|
||||
|
||||
- env: BUILD=stack ARGS="--stack-yaml stack-persistent-2-10.yaml"
|
||||
compiler: ": #stack/persistent 2.10"
|
||||
os: osx
|
||||
|
||||
- env: BUILD=stack ARGS="--resolver nightly"
|
||||
compiler: ": #stack nightly osx"
|
||||
os: osx
|
||||
|
||||
allow_failures:
|
||||
- env: BUILD=cabal GHCVER=head CABALVER=head HAPPYVER=1.19.5 ALEXVER=3.1.7
|
||||
- env: BUILD=stack ARGS="--resolver nightly"
|
||||
|
||||
before_install:
|
||||
# Using compiler above sets CC to an invalid value, so unset it
|
||||
- unset CC
|
||||
|
||||
# We want to always allow newer versions of packages when building on GHC HEAD
|
||||
- CABALARGS=""
|
||||
- if [ "x$GHCVER" = "xhead" ]; then CABALARGS=--allow-newer; fi
|
||||
|
||||
# Download and unpack the stack executable
|
||||
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$HOME/.local/bin:/opt/alex/$ALEXVER/bin:/opt/happy/$HAPPYVER/bin:$HOME/.cabal/bin:$PATH
|
||||
- mkdir -p ~/.local/bin
|
||||
- |
|
||||
if [ `uname` = "Darwin" ]
|
||||
then
|
||||
travis_retry curl --insecure -L https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin
|
||||
else
|
||||
travis_retry curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
|
||||
fi
|
||||
|
||||
# Use the more reliable S3 mirror of Hackage
|
||||
mkdir -p $HOME/.cabal
|
||||
echo 'remote-repo: hackage.haskell.org:http://hackage.fpcomplete.com/' > $HOME/.cabal/config
|
||||
echo 'remote-repo-cache: $HOME/.cabal/packages' >> $HOME/.cabal/config
|
||||
|
||||
|
||||
install:
|
||||
- echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
||||
- if [ -f configure.ac ]; then autoreconf -i; fi
|
||||
- |
|
||||
set -ex
|
||||
case "$BUILD" in
|
||||
stack)
|
||||
# Add in extra-deps for older snapshots, as necessary
|
||||
stack --no-terminal --install-ghc $ARGS test --bench --dry-run || ( \
|
||||
stack --no-terminal $ARGS build cabal-install && \
|
||||
stack --no-terminal $ARGS solver --update-config)
|
||||
|
||||
# Build the dependencies
|
||||
stack --no-terminal --install-ghc $ARGS test --bench --only-dependencies
|
||||
;;
|
||||
cabal)
|
||||
cabal --version
|
||||
travis_retry cabal update
|
||||
|
||||
# Get the list of packages from the stack.yaml file. Note that
|
||||
# this will also implicitly run hpack as necessary to generate
|
||||
# the .cabal files needed by cabal-install.
|
||||
PACKAGES=$(stack --install-ghc query locals | grep '^ *path' | sed 's@^ *path:@@')
|
||||
|
||||
cabal install --only-dependencies --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
|
||||
;;
|
||||
esac
|
||||
set +ex
|
||||
|
||||
script:
|
||||
- |
|
||||
set -ex
|
||||
case "$BUILD" in
|
||||
stack)
|
||||
stack --no-terminal $ARGS test --bench --no-run-benchmarks --haddock --no-haddock-deps
|
||||
;;
|
||||
cabal)
|
||||
cabal install --enable-tests --enable-benchmarks --force-reinstalls --ghc-options=-O0 --reorder-goals --max-backjumps=-1 $CABALARGS $PACKAGES
|
||||
|
||||
# Times out
|
||||
#ORIGDIR=$(pwd)
|
||||
#for dir in $PACKAGES
|
||||
#do
|
||||
# cd $dir
|
||||
# cabal check || [ "$CABALVER" == "1.16" ]
|
||||
# cabal sdist
|
||||
# PKGVER=$(cabal info . | awk '{print $2;exit}')
|
||||
# SRC_TGZ=$PKGVER.tar.gz
|
||||
# cd dist
|
||||
# tar zxfv "$SRC_TGZ"
|
||||
# cd "$PKGVER"
|
||||
# cabal configure --enable-tests --ghc-options -O0
|
||||
# cabal build
|
||||
# cabal test
|
||||
# cd $ORIGDIR
|
||||
#done
|
||||
;;
|
||||
esac
|
||||
set +ex
|
||||
15
README
15
README
@ -1,15 +0,0 @@
|
||||
Authentication methods for Haskell web applications.
|
||||
|
||||
Note for Rpxnow:
|
||||
By default on some (all?) installs wget does not come with root certificates
|
||||
for SSL. If this is the case then Web.Authenticate.Rpxnow.authenticate will
|
||||
fail as wget cannot establish a secure connection to rpxnow's servers.
|
||||
|
||||
A simple *nix solution, if potentially insecure (man in the middle attacks as
|
||||
you are downloading the certs) is to grab a copy of the certs extracted from
|
||||
those that come with firefox, hosted by CURL at
|
||||
http://curl.haxx.se/ca/cacert.pem , put them somewhere (for ex,
|
||||
~/.wget/cacert.pem) and then edit your ~/.wgetrc to include:
|
||||
ca_certificate=~/.wget/cacert.pem
|
||||
|
||||
This should fix the problem.
|
||||
@ -1,4 +1,4 @@
|
||||
[](https://travis-ci.org/yesodweb/yesod)
|
||||
[](https://dev.azure.com/yesodweb/yesod/_build/latest?definitionId=3&branchName=master)
|
||||
|
||||
# Yesod Web Framework
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
Release notes are maintained on the wiki.
|
||||
|
||||
https://github.com/yesodweb/yesod/wiki/Changelog (high level features)
|
||||
|
||||
https://github.com/yesodweb/yesod/wiki/Detailed-change-list (see for breaking changes)
|
||||
15
appveyor.yml
15
appveyor.yml
@ -1,15 +0,0 @@
|
||||
# cache:
|
||||
# - '%AppData%\stack'
|
||||
|
||||
install:
|
||||
- curl -sS -ostack.zip -L https://get.haskellstack.org/stable/windows-i386.zip
|
||||
- 7z x stack.zip stack.exe
|
||||
- stack setup > nul
|
||||
|
||||
build: off
|
||||
|
||||
build_script:
|
||||
- stack --no-terminal test --no-run-tests --resolver lts-11
|
||||
|
||||
test_script:
|
||||
- stack --jobs 1 --no-terminal test --resolver lts-11
|
||||
13
sources.txt
13
sources.txt
@ -1,13 +0,0 @@
|
||||
./yesod-core
|
||||
./yesod-static
|
||||
./yesod-persistent
|
||||
./yesod-newsfeed
|
||||
./yesod-form
|
||||
./yesod-auth
|
||||
./yesod-auth-oauth
|
||||
./yesod-sitemap
|
||||
./yesod-test
|
||||
./yesod-bin
|
||||
./yesod
|
||||
./yesod-eventsource
|
||||
./yesod-websockets
|
||||
@ -26,6 +26,7 @@ extra-deps:
|
||||
- persistent-sqlite-2.8.1.2@rev:0
|
||||
- project-template-0.2.0.1@rev:0
|
||||
- resourcet-1.2.1@rev:0
|
||||
- rio-0.1.8.0@rev:0
|
||||
- streaming-commons-0.2.0.0@rev:0
|
||||
- typed-process-0.2.2.0@rev:0
|
||||
- unliftio-0.2.7.0@rev:0
|
||||
|
||||
@ -8,6 +8,7 @@ import Language.Haskell.TH
|
||||
import Test.HUnit
|
||||
import Yesod.EmbeddedStatic.Types as Y
|
||||
import qualified Data.ByteString.Lazy as BL
|
||||
import RIO (HasCallStack)
|
||||
|
||||
-- We test the generators by executing them at compile time
|
||||
-- and sticking the result into the GenTestResult. We then
|
||||
@ -28,11 +29,15 @@ testEntry name _ _ e | ebHaskellName e /= (mkName Control.Applicative.<$> name)
|
||||
testEntry _ loc _ e | ebLocation e /= loc =
|
||||
[| GenError ("location " ++ $(litE $ stringL $ show $ ebLocation e)) |]
|
||||
testEntry _ _ act e = do
|
||||
expected <- runIO act
|
||||
actual <- runIO $ ebProductionContent e
|
||||
expected <- fmap stripCR $ runIO act
|
||||
actual <- fmap stripCR $ runIO $ ebProductionContent e
|
||||
if expected == actual
|
||||
then [| GenSuccessWithDevel $(ebDevelReload e) |]
|
||||
else [| GenError "production content" |]
|
||||
else [| GenError $ "production content: " ++ $(litE $ stringL $ show (expected, actual)) |]
|
||||
|
||||
-- | Remove all carriage returns, for Windows testing
|
||||
stripCR :: BL.ByteString -> BL.ByteString
|
||||
stripCR = BL.filter (/= 13)
|
||||
|
||||
testOneEntry :: Maybe String -> Y.Location -> IO BL.ByteString -> [Entry] -> ExpQ
|
||||
testOneEntry name loc ct [e] = testEntry name loc ct e
|
||||
@ -48,12 +53,13 @@ testEntries a b = listE $ zipWith f a' b'
|
||||
f (name, loc, ct) e = testEntry name loc ct e
|
||||
|
||||
-- | Use this at runtime to assert the 'GenTestResult' is OK
|
||||
assertGenResult :: (IO BL.ByteString) -- ^ expected development content
|
||||
assertGenResult :: HasCallStack
|
||||
=> (IO BL.ByteString) -- ^ expected development content
|
||||
-> GenTestResult -- ^ test result created at compile time
|
||||
-> Assertion
|
||||
assertGenResult _ (GenError e) = assertFailure ("invalid " ++ e)
|
||||
assertGenResult mexpected (GenSuccessWithDevel mactual) = do
|
||||
expected <- mexpected
|
||||
actual <- mactual
|
||||
expected <- fmap stripCR mexpected
|
||||
actual <- fmap stripCR mactual
|
||||
when (expected /= actual) $
|
||||
assertFailure "invalid devel content"
|
||||
assertFailure $ "invalid devel content: " ++ show (expected, actual)
|
||||
|
||||
@ -115,6 +115,7 @@ test-suite tests
|
||||
, wai
|
||||
, wai-app-static
|
||||
, yesod-core
|
||||
, rio
|
||||
|
||||
ghc-options: -Wall -threaded
|
||||
extensions: TemplateHaskell
|
||||
|
||||
@ -148,7 +148,13 @@ import qualified Data.Text.Encoding.Error as TErr
|
||||
import qualified Data.ByteString.Lazy.Char8 as BSL8
|
||||
import qualified Test.HUnit as HUnit
|
||||
import qualified Network.HTTP.Types as H
|
||||
|
||||
#if MIN_VERSION_network(3, 0, 0)
|
||||
import qualified Network.Socket as Sock
|
||||
#else
|
||||
import qualified Network.Socket.Internal as Sock
|
||||
#endif
|
||||
|
||||
import Data.CaseInsensitive (CI)
|
||||
import Network.Wai
|
||||
import Network.Wai.Test hiding (assertHeader, assertNoHeader, request)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user