on master help sign in
Fix failure to typecheck test case by pushing all assertions to the end of the test and operating with all dependencies on the Either type inside a do block.
20ed3abDiogo Biazus
.travis.yml+24−23
@@ -1,5 +1,5 @@
1# For more information, see https://github.com/ChrisPenner/haskell-stack-travis-ci
1# For more information, see https://github.com/ChrisPenner/haskell-stack-travis-ci
2−language: nix
2+language: c
3sudo: false
3sudo: false
4
4
5git:
5git:
@@ -15,45 +15,46 @@ cache:
15matrix:
15matrix:
16 fast_finish: true
16 fast_finish: true
17 include:
17 include:
18− - env: GHCVER=7.10.3 CACHE_NAME=7.10.3
18+ - env: CACHE_NAME=7.10.3 STACK_YAML=stack.ghc7.10.yaml GHC_VERSION=7.10.3
19 compiler: ": #stack 7.10.3"
19 compiler: ": #stack 7.10.3"
20 addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
20 addons: {apt: {packages: [ghc-7.10.3], sources: [hvr-ghc]}}
21
21
22− - env: GHCVER=8.0.2 CACHE_NAME=8.0.2
22+ - env: CACHE_NAME=8.0.2 STACK_YAML=stack.yaml GHC_VERSION=8.0.2
23 compiler: ": #stack 8.0.2"
23 compiler: ": #stack 8.0.2"
24 addons: {apt: {packages: [ghc-8.0.2], sources: [hvr-ghc]}}
24 addons: {apt: {packages: [ghc-8.0.2], sources: [hvr-ghc]}}
25
25
26− - env: GHCVER=8.2.1 CACHE_NAME=8.2.1 BUILD_BINARY=1
26+ - env: CACHE_NAME=osx-7.10.3 STACK_YAML=stack.ghc7.10.yaml
27+ os: osx
28+ osx_image: xcode6.4
27− compiler: ": #stack 8.2.1"
29+ compiler: ": #stack 7.10.3"
28− addons: {apt: {packages: [ghc-8.2.1], sources: [hvr-ghc]}}
29
30
30− - env: GHCVER=8.0.2 CACHE_NAME=8.0.2-osx BUILD_BINARY=1
31+ - env: CACHE_NAME=osx-8.0.2 STACK_YAML=stack.yaml
31 os: osx
32 os: osx
32 compiler: ": #stack 8.0.2"
33 compiler: ": #stack 8.0.2"
33
34
34−
35−# - env: GHCVER=8.2.1 CACHE_NAME=8.2.1-osx BUILD_BINARY=1
36−# os: osx
37−# compiler: ": #stack 8.2.1"
38−# addons: {apt: {packages: [ghc-8.2.1], sources: [hvr-ghc]}}
39−
40install:
35install:
41 - unset CC
36 - unset CC
42− - export PATH=$HOME/.local/bin:/opt/ghc/$GHCVER/bin:$PATH
37+ - export PATH=$HOME/.local/bin:/opt/ghc/$GHC_VERSION/bin:$PATH
43 - ./.travis/install-ghr.sh
38 - ./.travis/install-ghr.sh
44 - ./.travis/install-stack.sh
39 - ./.travis/install-stack.sh
45
40
46# Here starts the actual work to be performed for the package under test;
41# Here starts the actual work to be performed for the package under test;
47# any command which exits with a non-zero exit code causes the build to fail.
42# any command which exits with a non-zero exit code causes the build to fail.
48script:
43script:
49− - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"
44+ - GHC_OPTIONS=""
50− - stack --no-terminal --system-ghc build
45+ - |
51− - stack --no-terminal --system-ghc test
46+ set -ex
52− - stack --no-terminal --system-ghc haddock
47+ # Run tests
53−
48+ if [ "$(uname)" = "Darwin" ]; then
49+ stack --install-ghc --no-terminal test --ghc-options="$GHC_OPTIONS"
50+ else
51+ stack --no-install-ghc --system-ghc --no-terminal test --ghc-options="$GHC_OPTIONS"
52+ fi
53+ set +ex
54+
54−#after_success:
55+after_success:
55−# - |
56+ - |
56−# # Build and ship binary
57+ # Build and ship binary
57−# ./.travis/attach-binary.sh
58+ ./.travis/attach-binary.sh
58
59
59# EOF
60# EOF
.travis/install-stack.sh−2
@@ -25,5 +25,3 @@ if [ "$(uname)" = "Darwin" ]; then
25else
25else
26 travis_retry fetch_stack_linux
26 travis_retry fetch_stack_linux
27fi
27fi
28−
29−travis_retry stack --no-terminal setup;
test/Relation/StaticOptimizer.hs+4−4
@@ -124,10 +124,10 @@ testPushDownRestrictionPredicate :: Test
124testPushDownRestrictionPredicate = TestCase $ do
124testPushDownRestrictionPredicate = TestCase $ do
125 -- (s union relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}}) where status = 30 == (s where status=30) union (relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}} where status=30)
125 -- (s union relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}}) where status = 30 == (s where status=30) union (relation{tuple{city "Boston", s# "S6", sname "Stevens", status 50}} where status=30)
126 let rvs = RelationVariable "s" ()
126 let rvs = RelationVariable "s" ()
127− relationsOrError = do
127+ stevens <- case mkRelationFromList (attributes suppliersRel) [
128− stevens <- mkRelationFromList (attributes suppliersRel) [[TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]]
128+ [TextAtom "S6", TextAtom "Stevens", IntegerAtom 50, TextAtom "Boston"]] of
129− let expr1 = Restrict status30 (Union rvs (ExistingRelation stevens))
129+ Left err -> assertFailure ("stevens relation: " ++ show err) >> pure relationTrue
130− status30 = AttributeEqualityPredicate "status" (NakedAtomExpr (IntAtom 30))
130+ Right rel -> pure rel
131
131
132 expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
132 expectedExpr1 = Union (Restrict status30 rvs) (Restrict status30 (ExistingRelation stevens))
133 pure $ (expectedExpr1, (applyStaticRestrictionPushdown expr1))
133 pure $ (expectedExpr1, (applyStaticRestrictionPushdown expr1))